gateian / portfolio

0 stars 0 forks source link

Add shader material to instanced mesh #13

Closed gateian closed 2 months ago

gateian commented 2 months ago

Tricky to add shader it seems. Here is a working code example. https://codesandbox.io/s/d3-force-react-three-fiber-instanced-mesh-8zrp4?file=/src/Renderer.js:6224-6230

gateian commented 2 months ago

So while we can add a shader to an instanced mesh, it's worth considering that we do not have lighting and shadows. I'd have to write all that in my code. Might be a better approach to look at injecting shader code into the existing materials as outlined in this thread.

https://discourse.threejs.org/t/apply-shadow-in-shadermaterial/53833/3