Hi,
I’ve been able to use instancedMesh without too much trouble until I tried to use a ShaderMaterial instead of a built-in material.
I can’t get the lighting right, my guess is that the light position in the vertex shader needs to be updated to reflect the position of the instances, but I couldn’t find an example showing how to do this.
I recreated the problem by adding a ShaderMaterial to the webgl_instancing_dynamic example: https://jsfiddle.net/Natcher86/b9kpLsjc/50/
You can see that the light position is relative to each instance instead of being global.
Any recommandation or example that explain how to handle lighting in ShaderMaterial ?
Thanks!