Error in material with lighting
See original GitHub issueHey. Another very (!) Important error, found by me in the engine (infinitely trying to update the material). Because of this error, FPS catastrophically sags, so I learned where it comes from. To reproduce the minimum of the problem, you need:
- on the DirectionLight, BoxBufferGeometry with the assigned material (not based!, but for example MeshLambertMaterial)
- procedure render looks like this: camera.layers.set (1); renderer.render (scene, camera); camera.layers.set (0); renderer.render (scene, camera);
An error occurs here (it starts to work indefinitely until a light source or cube is visible):
method:
function setProgram( camera, fog, material, object )
line:
else if (material.lights && materialProperties.lightsHash! == lights.state.hash) {
material.needsUpdate = true;
}
The error can be reproduced not only using camera.layers, but in a number of other cases without layers even, it’s not them. I give a minimally reproducing error code.
I do not suggest a solution here, because I did not dig so deep to fix it, I wrote another rendering procedure for myself, but in the ideal, of course, it would be necessary to fix this. So I leave it for developers.
Issue Analytics
- State:
- Created 5 years ago
- Comments:12
Top GitHub Comments
The program
id
remains at zero if the material isMeshBasic
orMeshNormal
.Different layers can contain different lights, so if the material responds to lights, the program may need to be updated if the layers change.
https://jsfiddle.net/ctq6357t/14/
I have no numbers of a performance measurement but updating some uniforms will cause some overhead. But it shouldn’t be serious.