-
-
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
ShadersChunk: Only use clearcoat chunks when clearcoat > 0 #22405
Conversation
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.
yay!
todo = todo - 1;
clearcoat: useClearcoat, | ||
clearcoatMap: useClearcoat && !! material.clearcoatMap, | ||
clearcoatRoughnessMap: useClearcoat && !! material.clearcoatRoughnessMap, | ||
clearcoatNormalMap: useClearcoat && !! material.clearcoatNormalMap, |
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.
@WestLangley Should we do something like this for transmission
too? If so... what parameters depend on material.transmision > 0
?
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.
transmission: <float>,
transmissionMap: new THREE.Texture( <Image> ),
thickness: <float>,
thicknessMap: new THREE.Texture( <Image> ),
attenuationDistance: <float>,
attenuationTint: <Color>,
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.
Excellent! I'll do that on my next PR.
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.
But actually, transmission and volume are separate extensions. The last four are for volume.
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.
Oh! But... in the context of our shader chunks, do thickness and attenuation affect the material if transmission
is 0
?
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.
Related: You can do something like this for sheenTint too, so the version will be incremented when sheenTint is changed from black to not-black.
Would love to see that. That would make the physical exclusive properties more consistent.
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.
So then the logic would be like this?
if ( transmision > 0 ) {
transmission: <float>
transmissionMap: new THREE.Texture( <Image> )
if ( thickness > 0 ) {
thickness: <float>
thicknessMap: new THREE.Texture( <Image> )
attenuationDistance: <float>
attenuationTint: <Color>
}
}
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.
Yes, something like 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.
There should be USE_TRANSMISSION
and USE_VOLUME
.
It is up to you if USE_TRANSMISSION
is used to mean "transmission_without_volume" -- a.k.a. thin surface only.
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.
Oh! But... in the context of our shader chunks, do thickness and attenuation affect the material if transmission is 0?
No.
Description
Currently
MeshPhysicalMaterial
computed shader includes clearcoat chunks even whenmaterial.clearcoat
is0
. This PR solves that and does some additional clean up.