I have a map definition with plenty of light sources (about 350). When I'm trying to create THREE.PointLight objects and add them to the scene, I'm getting the following error along with low FPS:
three.js:29438 THREE.WebGLProgram: shader error: 0 gl.VALIDATE_STATUS false gl.getProgramInfoLog Fragment shader active uniforms exceed MAX_FRAGMENT_UNIFORM_VECTORS (1024).
What does it mean? Is there some limit of THREE.PointLight objects on the scene? Are there any good practices to keep high performance when you have many light sources?
For now the only idea that comes to mind is somehow reduce the number of light sources and leaving only those that I really need.
This error means you've exceeded the maximum number of uniforms in your fragment shader. This limit is determined by your graphics card and/or driver. You can check by going to http://webglreport.com/.
Looks like on your system the limit is 1024. A Three.js light typically uses 6-10 uniforms depending on the type of light and the material. Given you're using ~350 lights, it makes sense that you're blowing way past this limit.
Generally speaking, 350 discrete lights is a lot, probably way more than you need. Using more lights is also computationally intensive. A typical WebGL scene has no more than a handful. You might want to consider other techniques to achieve what you want.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments