Hello everyone.

The Mixed Reality Forums here are no longer being used or maintained.

There are a few other places we would like to direct you to for support, both from Microsoft and from the community.

The first way we want to connect with you is our mixed reality developer program, which you can sign up for at https://aka.ms/IWantMR.

For technical questions, please use Stack Overflow, and tag your questions using either hololens or windows-mixed-reality.

If you want to join in discussions, please do so in the HoloDevelopers Slack, which you can join by going to https://aka.ms/holodevelopers, or in our Microsoft Tech Communities forums at https://techcommunity.microsoft.com/t5/mixed-reality/ct-p/MicrosoftMixedReality.

And always feel free to hit us up on Twitter @MxdRealityDev.
Options

Dynamically generate holograms

Has anyone been able to dynamically generate holograms in app? I would like to be able to let the user generate his/her own holograms. I have an idea of how I can do it but I'm not sure how to implement it. I would generate a list of vertices and then somehow put a mesh over top. I am not sure if the unity platform can do that or if I need to use directx (which I don't know much about sadly).

Tagged:

Best Answers

Answers

  • Options

    You guys are great! Thank you so much!

  • Options

    Is there a difference between dynamically creating meshes vs dynamically creating holograms?

    I am trying to generate a plane by having the user set 4 vertices in the real world (using the height (y axis) of the first vertex for all the rest of them so the plane stays on that y "plane" but then using the x and z coordinates for each of the remaining vertices). I am using the world cursor's position and air tapping in order for the user to set the 4 vertices. I wrote the following code on an empty game object with a material, a mesh filter and a mesh renderer component, but no visible mesh is generated when I have set all 4 vertices. Can anyone please tell me what I'm doing wrong? I know the air taps are being recognized correctly from debugging..

    using UnityEngine;
    using System.Collections;
    using System.Collections.Generic;

    public class EditPlane : MonoBehaviour {

    public TempStateManager stateManager;
    public TextMesh debug;
    private List<Vector3> vertexHolder;
    private Vector3 firstVertex;
    public GameObject cursor;
    private int input;
    // Use this for initialization
    void Start() {
        vertexHolder = new List<Vector3>();
        input = 0;
    }
    
    
    void OnSelect()
    {
        if (stateManager.state == "setVertices")
        {
    
            if (input < 4)
            {
                if (input == 0)//first time
                {
                    firstVertex = cursor.transform.position;//save first y position
                    //add first vertex (vertex 0)
                    vertexHolder.Add(firstVertex);
                    Debug.Log("added first vertex");
                    debug.text = "added first vertex";
                }
                else 
                {
                    Vector3 newVertex = new Vector3(cursor.transform.position.x, firstVertex.y, cursor.transform.position.z);
                    //add vertices 1, 2, and 3
                    vertexHolder.Add(newVertex);
                    Debug.Log("added subsequent vertex");
                    debug.text = "added subsequent vertex";
                    if(input ==3)//last input
                    {
                        debug.text = "last vertex";
    
                        //triangles
                        int[] tri = new int[6];
                        tri[0] = 0;
                        tri[1] = 2;
                        tri[2] = 1;
    
                        tri[3] = 2;
                        tri[4] = 3;
                        tri[5] = 1;
    
                        //normals
                        Vector3[] normals = new Vector3[4];
                        normals[0] = Vector3.up;
                        normals[1] = Vector3.up;
                        normals[2] = Vector3.up;
                        normals[3] = Vector3.up;
    
                        Mesh mesh = new Mesh();
                        GetComponent<MeshFilter>().mesh = mesh;
                        mesh.SetVertices(vertexHolder);
                        mesh.triangles = tri;
                        mesh.normals = normals;
                        debug.text = "set mesh";
    
    
    
                    }
                }
                input++;
            }
        }
    
    }
    

    }

    Thanks!

  • Options
    edited September 2016

    Here's a Gem from the past. Probably as old as unity itself:

    wiki.unity3d.com/index.php/ProceduralPrimitives

    Stephen Hodgson
    Microsoft HoloLens Agency Readiness Program
    Virtual Solutions Developer at Saab
    HoloToolkit-Unity Moderator

  • Options

    @SashaFC said:
    Is there a difference between dynamically creating meshes vs dynamically creating holograms?

    Essentially no, they're the same thing. A Hologram is what's rendered in front of you on device.

    Stephen Hodgson
    Microsoft HoloLens Agency Readiness Program
    Virtual Solutions Developer at Saab
    HoloToolkit-Unity Moderator

  • Options

    @stephenhodgson thank you!

Sign In or Register to comment.