pmndrs / gltfjsx

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

Changing individual mesh color without changing material color #119

Open jasan-s opened 2 years ago

jasan-s commented 2 years ago

A 3d model (Lieutenant Head) , has many mesh parts with same material. I was trying to change color of parts using mouse events , (i.e onPointerOver, onClick) using react-colorful lib hexcolorPicker .

However using the clicked state hex with material-color changes the material color for all parts using the material, I instead want to change color on single part using the hexcolorPicker without effecting the other parts that also use the samematerial.

From the above mentioned 3d model I wanted to change the color for nodes["node_Bandages_-5158"] only however it also changes the color of nodes["node_Head_-5164"] because they both share the material named "Lieutenant_Head".

An example or documentation would be greatly helpful

zqian7531 commented 3 weeks ago

Did you find the answer? I had the same problem.

zqian7531 commented 3 weeks ago

Did you find the answer? I had the same problem.

I know why. Because they share the same object instance.