-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
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
Shaders: Initialize geometryClearcoatNormal
to suppress OpenGL warning.
#27002
Conversation
Fix of 0(1578) : 'warning C7050: "geometryClearcoatNormal" might be used before being initialized' mrdoob#26994 issue.
📦 Bundle sizeFull ESM build, minified and gzipped.
🌳 Bundle size after tree-shakingMinimal build including a renderer, camera, empty scene, and dependencies.
|
geometryClearcoatNormal
to suppress OpenGL warning.
Initializing a normal to zero raises a red flag: normals are of unit length. Looking into this, But you can't do that because of the refactoring in done in #26805.
// Also, |
This initialization is purely technical. As long as the code doesn't use the normal, I see no issue, tbh. |
Applying the same change like in #27002.
@WestLangley Would it be better to initialize it as |
@mrdoob The real problem is it shouldn't be instantiated at all if it is not going to be used. |
Ah, so we could do this instead? #ifdef USE_CLEARCOAT
vec3 geometryClearcoatNormal = clearcoatNormal;
#endif |
This does not work which is explained here: #27002 (comment) |
I have the feeling we overthink this issue a bit. As long as |
Fix of 0(1578) : 'warning C7050: "geometryClearcoatNormal" might be used before being initialized'
Fixed #26994
Description
This warning appears while running ThreeJS on top of WebGL implementation that uses system OpenGL directly.
In particular in Sciter Engine on Windows with OpenGL 4.6 / NVIDIA drivers.
This warning manifests on any attempt to use "physical" materials like:
Note, no such warning in non-physical materials like MeshNormalMaterial