-
-
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
MeshPhysicalMaterial: Fix shader error for clear coat/anisotropy when normal map is missing. #26334
Conversation
📦 Bundle sizeFull ESM build, minified and gzipped.
🌳 Bundle size after tree-shakingMinimal build including a renderer, camera, empty scene, and dependencies.
|
Thanks, that looks reasonable to me. |
I can confirm this fixes the issues for me as well! Merging for now so we have a hotfix for |
@@ -1,5 +1,5 @@ | |||
export default /* glsl */` | |||
#ifdef USE_UV | |||
#if defined( USE_UV ) || defined( USE_ANISOTROPY ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this line is required, then USE_UV
is not properly defined.
It's also possible to set USE_UV in javascript instead of checking for USE_ANISOTROPY while defining the variable.
Right. Why didn't you do that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was not sure what the plan was for USE_UV
after #25740 and a hotfix was required.
Do you recommend setting parameters.vertexUvs
when anisotropy is present or creating the define
either in WebGLProgram
or WebGLRenderer
.
Also, there is vAnisotropyMapUv
that could be considered or defined cleanly when no normal map is present.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, there is vAnisotropyMapUv that could be considered or defined cleanly when no normal map is present.
I would favor this approach (if feasible) since anisotropy would work similar to clear coat then.
Related PR discussion: #25580 (comment)
Description
Add support for using vUv or vClearcoatMapUv for anisotropy when normal map is not present.
This is the smallest fix. It's also possible to set USE_UV in javascript instead of checking for USE_ANISTROPY while defining the variable.
Fixes loading of model from: https://discourse.threejs.org/t/shader-error-0-validate-status-false/53195/2
Model: https://sketchfab.com/3d-models/free-1975-porsche-911-930-turbo-8568d9d14a994b9cae59499f0dbed21e#download