-
-
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
Improve MeshPhysicalMaterial transmission support Part2 #21975
Conversation
Have you tried running |
Now that it is looking better, we need to figure out how to properly deal with For a later PR, of course. |
Ah, I didn't notice that I needed to run it in the
Good catch. Updated, thanks! |
Excellent! Thanks! |
const currentToneMapping = _this.toneMapping; | ||
_this.toneMapping = NoToneMapping; |
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! Actually... I guess we should also set outputEncoding
to LinearEncoding
?
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.
No because we use renderTarget texture's encoding as output encoding if currentRenderTarget
isn't null
. (Texture's default encoding is linear.)
https://github.com/mrdoob/three.js/blob/r129/src/renderers/webgl/WebGLPrograms.js#L174
If we will start to copy the framebuffer we will need to convert from sRGB to linear and from tone mapping to none in the shader if they are set.
Related issue: #21884 (comment)
Description
This PR improves
MeshPhysicalMaterial
transmission
support.@WestLangley Looking good now?
Changes
diffuseColor
https://github.com/mrdoob/three.js/blob/r129/src/renderers/shaders/ShaderChunk/transmission_fragment.glsl.js#L30
and then applied lighting to it. This is the main reason why the color was darken even if transmission is 1. In this PR I apply the transmission after the lighting.
https://github.com/mrdoob/three.js/blob/r129/src/renderers/shaders/ShaderChunk/transmission_pars_fragment.glsl.js#L80-L82
Screenshots
I still have an issue that multi sample render target is black in the screenshots. So I made the screenshots by temporarily changing the code to non-multi-sample render target. Please feel free to update the screenshots if you can make correctly.