pmndrs / gltfjsx

🎮 Turns GLTFs into JSX components
https://gltf.pmnd.rs
MIT License
4.45k stars 290 forks source link

Instances and Materials #147

Open BooneAllred opened 2 years ago

BooneAllred commented 2 years ago

What is the difference between using --instance, -i Instance re-occuring geometry --instanceall, -I Instance every geometry (for cheaper re-use)

I noticed when you use a -i that the group contains the geometry and the material, however if you use the -I the group doesn't contain the material.

Is it possible to access the material to change it inside of the instanceall code?

I am currently doing a environment layout and approaching this project like you would in a game engine, by reusing the geometry for the walls to reduce drawcalls. I would also like to create a few materials that I could assign to each wall to add some variety in the environment. I would think it would be better to only declare the materials once and reuse them on the instance geometry vs declaring them or changing them for every piece of geometry. Sorry I come from a 3D background and not a coding even though I can understand and read and write some code. Is my thought process wrong for how to approach this?

Or would it be easier to just assign the materials inside of blender before I export them and react is smart enough to reuse the materials without having to create new ones?