Search Unity

Mesh QR Code Generator - Generating QR codes in 3D

Discussion in 'Assets and Asset Store' started by stefan_s_from_h, Nov 8, 2018.

  1. stefan_s_from_h

    stefan_s_from_h

    Joined:
    Nov 26, 2017
    Posts:
    72
    04-Skyline_Unity_2018-11-02_15-44-30.png

    There are many QR code generators out there. The Mesh QR Code Generator is different. Instead of getting a bitmap you get a 3D object (respectively multiple objects) to work with.
    This gives you more creative opportunities than a flat and boring code. You can leave out parts of the code to fit your ideas because of the error correction feature of QR codes. Ideal for mazes.
    Possible applications of 3D QR codes:

    • Imagine a camera flying through a maze and then taking off to the sky, turning back to the maze it just left and you see a QR code. Take out your smartphone and scan the code.
    • Hidden Easter egg hanging on a wall but only recognizable when you look at it at a certain angle.
    • Ad with animated QR code at the end flying at you for dramatic effect. Standing still long enough for you to scan it with your phone.
    • Your game gives you a secret code for a raffle. The QR code is animated so that people with cheap and slow phones don’t have a chance to win the prize. ]:->
    • Showing off the URL to your website. “Can you give me the link to your site?” – “Sure. Here’s a QR code on my phone for you to scan.” – “Why is it moving?” – “Because it’s linked to the gyroscope.”
    • You enter some text (can be a URL) and a QR code maze gets generated. Surviving all the dangers in the maze you win all the fights and reach the exit. Now the camera shows the maze from above with the trail you left. You can save a screenshot and now have a unique QR code you had to fight for.
    • A variation of the “build the pattern we show you here” games. Two main differences: 1. it’s lot more complicated and 2. you don’t need to be 100% perfect and complete because of the error correction. Show the pattern with a too difficult contrast for QR code scanners so it is only possible to scan it after you move blocks with a darker color at the right places.
    • Just a display of a QR code maze in a shop window with animated monsters running around in it. Or something specific to the shop like cars and the QR code is the URL to the company’s website.
    The possibilities are endless and more fun than bitmaps.
    Let the component generate a QR code automatically or controlled by script.

    See in Asset Store with multiple videos and screenshots.

    WebGL Demo Come at me

    WebGL Demo Timepiece


    Changelog
    1.3
    (2019-09-25)
    • Small fixes in documentation.
    • Tip about using callbacks together with visual scripting tool Bolt.
    • Rotation, scaling, etc. from Parent won’t get ignored anymore.
    • New property IsReady to indicate that the generated QR code is complete.

    1.2 (2019-03-12)
    • Documentation comments for API code.
    • New property HeightScale to have a fixed height for the generated QR code regardless of the QR code’s size.
    1.1 (2018-12-07)
    • New methods Clear, to remove the currently displayed modules (QR code vanishes), and ClearAll, to remove all modules, including the ones in the object pool.
    • Tips section in documentation.
     
    Last edited: Sep 25, 2019
  2. stefan_s_from_h

    stefan_s_from_h

    Joined:
    Nov 26, 2017
    Posts:
    72
    Do you want to 3D print a QR code? There are multiple howtos on the web. With Mesh QR Code Generator there is another way: Use ProBuilder (free asset) and make a scene with a base cube (X:10, Y:1, Z:10, pos 1,0,-1) as a bottom plate and position your container for the QR code in the middle (on surface, pos 5,1,-5) of it. Hit play.

    Now go back to the Scene view, select the QR code container in the Hierarchy window, click "ProBuilderize" in the ProBuilder window, then shift-select the base, click "Merge Objects" (ProBuilder). Now you have one object.

    "Export" in the ProBuilder lets you export the whole thing as a .obj file (or .stl, etc.). Usable with 3D software like Blender.
     
    Last edited: Nov 15, 2018
  3. stefan_s_from_h

    stefan_s_from_h

    Joined:
    Nov 26, 2017
    Posts:
    72
    Released version 1.1 today.

    Changelog
    1.1
    (2018-12-07)
    • New methods Clear, to remove the currently displayed modules (QR code vanishes), and ClearAll, to remove all modules, including the ones in the object pool.
    • Tips section in documentation.
     
  4. stefan_s_from_h

    stefan_s_from_h

    Joined:
    Nov 26, 2017
    Posts:
    72
    Released version 1.2 today.

    Changelog
    1.2
    (2019-03-12)
    • Documentation comments for API code.
    • New property HeightScale to have a fixed height for the generated QR code regardless of the QR code’s size.

    A QR code can have between 21x21 and 177x177 modules (ignoring the quiet zone). When scaling the generated QR code down to MaxSize you may end up with a really flat code. With HeightScale you can define the fixed scale on the y axis.
     
  5. stefan_s_from_h

    stefan_s_from_h

    Joined:
    Nov 26, 2017
    Posts:
    72
    Used the asset together with Bolt and there's no way to make a callback in a Bolt graph.

    This small component sends a custom event "qrready" to the graph of the current game object. You only need to set the On Qr Ready callback in the Mesh QR Code component to the QrReady method in this script:

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using Bolt;
    5.  
    6. public class MeshQR2Bolt : MonoBehaviour
    7. {
    8.     public void QRReady()
    9.     {
    10.         CustomEvent.Trigger(gameObject, "qrready");
    11.     }
    12. }
    13.  
    upload_2019-4-10_14-56-28.png

    upload_2019-4-10_14-54-48.png
     
  6. stefan_s_from_h

    stefan_s_from_h

    Joined:
    Nov 26, 2017
    Posts:
    72
    This was used for my entry to the Bolt Jam #5: Please Don't Crash

    Itch-Cover-Image.jpg

    Yes, these floating blocks are the modules of a 3D QR code.
     
  7. stefan_s_from_h

    stefan_s_from_h

    Joined:
    Nov 26, 2017
    Posts:
    72
    Released version 1.3 today

    Changelog
    1.3
    (2019-09-25)
    • Small fixes in documentation.
    • Tip about using callbacks together with visual scripting tool Bolt.
    • Rotation, scaling, etc. from Parent won’t get ignored anymore.
    • New property IsReady to indicate that the generated QR code is complete.