Hello everyone.

We have decided to phase out the Mixed Reality Forums over the next few months in favor of other ways to connect with us.

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.

The plan between now and the beginning of May is to clean up old, unanswered questions that are no longer relevant. The forums will remain open and usable.

On May 1st we will be locking the forums to new posts and replies. They will remain available for another three months for the purposes of searching them, and then they will be closed altogether on August 1st.

So, where does that leave our awesome community to ask questions? Well, there are a few places we want to engage with you. 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. And always feel free to hit us up on Twitter @MxdRealityDev.

Loading a big 3D model at runtime

Hey everyone,

As a part of my research project, I need to download the 3D model from my web server, which is output of a photogrammetry software, so these models are huge(as big as 1.4 million vertices in the mesh). After downloading the model, I am not able to render it at runtime due to number of vertices in it as Unity does not load anything more than 65536 vertices for a mesh.

However, when I try to render the same model in Unity Editor, Unity is making 22 groups of the model(with 65532 vertices in each) and then it loads smoothly without any problem on HoloLens.

So only option(unless I am missing something) is to break the model into multiple groups of vertices not more than 65536 each, before saving it onto server.

Can you recommend or point me into direction of achieving this?

Best Answer

Answers

  • Wait a second. What do you mean the hololens loads 22 groups of 65k verts each and loads smoothly without problem? The Hololens has performance issues trying to render 100k verts. Are you just rendering 1 part of the model at a time and culling the rest?

    I'd think something like blender could be used to split it apart.

    Taqtile

  • Means in the Unity editor, when I drag and drop the 3D object into my Scene, I can see 22 groups under my 3d model's name in Hierarchy.

    So when I deploy this app on HoloLens, it already has the 3d model in 22 parts. Hope that clears up?

  • No, I get that. I just also understand that the device can not handle rendering anywhere near that number of verts. But makes sense if you are only rendering part of the model at a time with the rest being culled.

    Have you tried blender to split it up?

    Taqtile

  • Not yet, I have downloaded Blender following some tips online. Should be using that this week. Let's see if I can resolve it.

    Pretty sure this cannot be a limitation for HoloLens; there "has" to be a way around.

  • trzytrzy ✭✭✭

    I'm also baffled as to how this is even running on the HoloLens with that many vertices -- even if it's split up into 22 meshes. The performance must be abysmal?

    How are you loading it from the web? How do you create the Unity GameObject, in other words? It should be easy to write code to split the model up automatically.

  • Are you looking at the entire model (all 22 meshes) at once in the HoloLens or are many (most) hidden? HL struggles to reach 100K with 'fastest' quality setting in Unity and a single directional light.

  • @trzy The performance with 22 meshes isn't abysmal it all, on contrary it's pretty smooth.
    To load it from the web I bought an asset

    Now the issue is loading such an heavy object at runtime. Now I am trying to split the vertices and load em one by one at runtime.

  • trzytrzy ✭✭✭

    You have a 1.4M vertex model running on the HoloLens smoothly?

    Is the problem then that it takes too long to load? How did you get it to load in the first place? Or are you running it via holographic remoting (in which case the rendering is actually done on the PC)?

  • @DocStrange I am loading all the 22 meshes at once. There's no hidden mesh. All the meshes complete the bigger model together. With my model loaded, the performance is not shitty at all. I can move around it, rotate and scale it. It's like the Boeing's promotional video, you know.

  • Something is wrong with your math or we aren't fully understanding your setup because the device can not render 1.4m verts. 10% of that would result in poor performance.

    I have seen that many verts run fine during Holographic remoting as @trzy mentioned. Holographic remoting means the computer is doing the heavy lifting. Is that what you are doing?

    Otherwise I'd love any screenshots to help us better understand your setup and how you achieved that many verts on the device without making it come to a crawl.

    Taqtile

  • okay, here are some screenshots. I had to sketch some part out.
    1. hierarchy, see how unity made 22 sub meshes under my main 3d model(fbx, or obj)

    2. On right side, you can see it has 65532 vertices in each mesh. It's a huge model since it's a photogrammetry output. ( all the meshes have around 65k vertices)

    And when I build and deploy on hololens, it just runs fine.

  • Can you toggle open the stats button in the game scene. That will display how many verts are being drawn.

    Taqtile

  • chiddaanchiddaan
    edited May 2017

    Here u go. Not sure why it's 2.8m, but my model has only 1.4m

  • Thanks! Have you tried deploying with a FPS counter displaying? Or with the profiler running? Looks like its running at 30fps on your PC which I'd assume is faster than the device even with the editor running.

    Taqtile

  • chiddaanchiddaan
    edited May 2017

    I didn't try deploying with the counter displaying or the profiler running as I never felt the need, and my PC is pretty good. Regardless, I never faced any issue when running on HoloLens. My application has the size of around 270MB, and it's all good.

  • thebanjomaticthebanjomatic ✭✭✭
    edited May 2017

    @chiddaan If you have the "simulate in editor" holographic remoting enabled, then the number of vertices and triangles will be roughly double because of it rendering both eyes. I am also curious as to the actual framerate because if you are only hitting 30fps in Unity, its safe to say you probably aren't hitting 60fps on the device.

    Unfortunately I don't have specific guidance about how you should split your meshes. If it doesn't need to be super dynamic, you could use something like Simplygon as a pre-processing step to reduce the vertex count. This would help a lot with both general performance and also in terms of the maximum vertex count per mesh.

  • @thebanjomatic Thanks for mentioning Simplygon, I gave it a try and it reduced the number of vertices considerably. But that came with the huge cost of quality, which apparently isn't acceptable to my professor.

    I know unity does this at compile time, I wonder if they have a webservice that can do this at runtime?

  • @chiddaan I believe they do have a new REST API for this that is in preview: https://labs.simplygon.com/#apidoc

  • chiddaanchiddaan
    edited June 2017 Accepted Answer

    Hey guys,
    @mark_grossnickle @trzy @DocStrange @thebanjomatic
    Thank you for all your help!

    This issue is resolved. Now I am able to load a million vertices with 40-50 fps in stats.

    I was able to achieve this using this asset on Unity store

    If you need to use it, I highly recommend it.

  • Hi @chiddaan , do you have to load your model from the web using the objreader or there exists a simple script to load it?

  • @khcy82dycc This script will take care of downloading and importing it to the scene. You just need to have relevant REST APIs on your web server for downloading the model.

Sign In or Register to comment.