Rhino3dm.js + three.js model viewer - Material & Textures issue

Hello all,

I am building a model viewer for .3dm files using rhino3dm.js and three.js. I am able to view the model using the object colours that I have set in the rhino model but I am having trouble with textures.

In the Rhino file, I have made a PBR material called “brick” and applied a simple brick texture to the diffuse channel. I then applied this material to a simple geometry and I saved the file making sure the save textures box was checked. Yet I am unable to find this material or texture in the model object returned by rhino3dm.js

Does anyone know where to look in the model object for this material & texture information? If anyone has a basic example of textures working with rhino3dm.js and three.js and able to share it - that would be awesome! :pray:

Kind regards,
Krishna

The object should have some attributes which include material information. You might want to check out the 3dmLoader for how we extract all of the Rhino information and create threejs objects.: three.js/examples/jsm/loaders/3DMLoader.js at dev · mrdoob/three.js · GitHub

In general, you’ll want to look in the doc’s renderMaterial collection: doc.renderMaterials(), where doc is a file3dm. Here is a related example: rhino-developer-samples/rhino3dm/js/node/Samples/ReadDocMaterials.js at 8 · mcneel/rhino-developer-samples · GitHub

If you can, please attach a simple model and I can see about making a sample which highlights how to access this info.