I’m trying to achieve multiple spotlights that move across each mesh material individually, illuminating the specific areas of the bump map in each spotlight’s path.
Currently, a single spotlight moves across the mesh and highlights the bump map area within the spotlight’s effect.
I have passed the uLightPosArray as following in shaderMaterial. when I am trying to access that array in fragment shader, spotlight isn’t getting generated. even though for testing purpose I have passed the same object as the uLightPos object (by using that spotlight is correctly generated) in array still spotlight isn’t getting generated.
I am not able to use the passed array in shader and I am stuck in generating multiple spotlight on each mesh. if anyone can suggest a method or way by which we can generate a fix number of spotlight for each mesh (i.e. maxSpotlights : 3), and that spotlight movement can be handled on the mesh from animate() function.
note : spotlight is working correctly when single position is passed, and movement of that is managed in animate function of script.js
You’re using version 84 of THREE.js, current version is 170. I’d suggest updating to the latest version, your code is small enough so it shouldn’t take too long.
I have removed the import of v84 script from index.html. I missed to remove that import previously. with newer version of threejs, is it possible to access the positionArray in shaderMaterial ?
I understood a bit. I was using uLightPosArray for spotlight in fshader. and updating the uLightPos in animate function. that’s why it was not working.