Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Error when using MeshLambertMaterial #182

Open
bennlich opened this issue Feb 2, 2022 · 5 comments
Open

Bug: Error when using MeshLambertMaterial #182

bennlich opened this issue Feb 2, 2022 · 5 comments

Comments

@bennlich
Copy link

bennlich commented Feb 2, 2022

Occasionally, when I create a TroikaThreeText with a MeshLambertMaterial, the text does not render and I see this error:

THREE.WebGLProgram: shader error:  1281 35715 false gl.getProgramInfoLog Field names of uniform 'spotLights' differ between VERTEX and FRAGMENT shaders.

However, this bug does not occur if the TroikaThreeText is the only object in my scene. It seems to involve some interaction between the TroikaThreeText and other objects in the scene. I will work on narrowing this down, but I'm wondering if anything sticks out to you about this error.

Sincerely loving TroikaThreeText! Thank you!

@lojjic
Copy link
Collaborator

lojjic commented Feb 8, 2022

Sounds like possibly something going wrong with the shader rewriting, but it's not obvious to me at first glance. And I don't know why it would be inconsistent based on other objects in the scene ... very curious.

If you can come up with a minimal test case that would help greatly. If not, maybe pasting the contents of the final shaders from the log would give some clues?

@lojjic
Copy link
Collaborator

lojjic commented Feb 8, 2022

Ah I bet this is due to these lines which rename usages of the position uniform in the vertex shader. Since that spotLights struct has a position property in it, that will also be rewritten, which would obviously cause problems.

This seems like it would fail whenever there are spot lights in the scene, might the "other objects in the scene" trigger happen to be presence of spot lights?

@bennlich
Copy link
Author

bennlich commented Feb 8, 2022

Ahhhh, I see. Thank you. I haven't had time to verify this but it's totally plausible that the "other objects in the scene" do have spotlights. (They are GLBs, so they can contain all manner of things.) I'll try and inspect them soon.

@lojjic
Copy link
Collaborator

lojjic commented Feb 8, 2022

Yep, I can reproduce the bug with MeshLambertMaterial and a SpotLight in the scene, that's definitely the problem. Should be a pretty simple fix.

@bennlich
Copy link
Author

Wow! Cool! You found that with very little to go on :-P Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants