question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error in material with lighting

See original GitHub issue

Hey. 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:

  1. on the DirectionLight, BoxBufferGeometry with the assigned material (not based!, but for example MeshLambertMaterial)
  2. 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:closed
  • Created 5 years ago
  • Comments:12

github_iconTop GitHub Comments

1reaction
WestLangleycommented, Apr 13, 2018

The program id remains at zero if the material is MeshBasic or MeshNormal.

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/

0reactions
Mugen87commented, Apr 18, 2018

but did not delve into the load, i.e. she in this case will be a little?

I have no numbers of a performance measurement but updating some uniforms will cause some overhead. But it shouldn’t be serious.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What are the most common errors in lighting? - Coblonal
What are the most common errors in lighting? · A light without planning · Natural light, the heart of enlightenment · Balance, the...
Read more >
Perception of Lighting Errors in Image Compositing
In this paper we describe a series of experiments that investigate the role that lighting errors in the source material have on the...
Read more >
WebGL error when toggling lights with freezed materials - Bugs
The workaround is to do what you did: unfreeze the materials, modify the lights, freeze the materials again. Yup totally expected but I...
Read more >
Lightmap Bake Error - Rendering - Unreal Engine Forums
Hello, I am currently working on a interior scene and everything is going fine until when I bake one of my ad banner...
Read more >
Light halo through objects with cutout material - Enscape Forum
The issue seems to be that a rectangle light (I didn't test other light types) is acting like it is refracting through a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found