Community

Topic: Xamarin component

glTF Model Support?

Dominic Jones
Thursday, March 11, 2021

Hi again!

I'm finding it difficult to export 3D models to Three.js JSON format (which I presume is the required format for 3D models currently?) as it is now superseded by glTF for WebGL - is it possible to add support for glTF files in the mesh.cs library?

Or is there another way to easily load a different (non-EOL) file type for the GL Renderer to use? OBJ/MTL would be fine, for instance...

Thanks again!
Dom

Dominic Jones
Thursday, March 11, 2021

Quick follow-up:

I discovered from the Monkey.Json file that it is the MeshLab JSON format that you are parsing for in your mesh loader, so I think that gets basic file loading sorted for now...
Are there any key requirements/considerations I should be aware of regarding creating 3D models for the current system?
I would love to add support for glTF so I am going to look at altering Mesh.cs to import glTF models via the glTF2Loader Nuget package.
I'll be happy to share that code if/when I get it running by way of paying back and helping others who may want to do similarly. Hopefully it shouldn't be too complex but I'll shout if I encounter any difficulties!
I would, however, like to add support for materials, which do not seem to be supported in your mesh/render pipeline currently - can you advise on how I might go about that from a data and rendering perspective without re-writing too much of the code as it stands?

user profile image
Support Team  (expert)
Thursday, March 11, 2021

Hi,

Adding support for materials is going to require lots of changes, depending on what materials you want to support (PBR or something simpler?) and how,
I don't think you'll need to rewrite much of the existing code for simpler material (probably rewriting the DrawMesh function will be enough), but you'll need to add lot of code to manage materials and their rendering.

Best regards

Dominic Jones
Friday, March 12, 2021

Thanks,

I will probably leave materials for a while in that case - if I can get glTF models/textures loading into your data formats then that will be very helpful.

I'll get into that as soon as I get a chance and let you know how I get on!...

Cheers,
Dom

Sign in to add a comment