-
-
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
WebGLRenderer: Use inline tone mapping only when rendering to screen. #26371
Conversation
📦 Bundle sizeFull ESM build, minified and gzipped.
🌳 Bundle size after tree-shakingMinimal build including a renderer, camera, empty scene, and dependencies.
|
This PR actually fixes |
src/renderers/WebGLRenderer.js
Outdated
|
||
if ( material.toneMapped ) { | ||
|
||
if ( _currentRenderTarget === null || ( _currentRenderTarget !== null && _currentRenderTarget.isXRRenderTarget === true ) ) { |
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.
Without this additional check, tone mapping would not properly work in XR environments. It's essentially the same check like for colorSpace
.
we noticed that this pr breaks postprocessing, and HDR workflow. for instance we would previously set materials to toneMapped=false and then go beyond RGB 0-1, which gets then picked up by the threshold set by the bloom pass. threshold=1 means nothing gets bloom except the materials that go over threshold. now the toneMapped property has no effect and practically everything that blooms is now broken. is there a migration path? |
To clarify, this change did not break post processing and HDR workflow in this repository.
The idea is to apply tone mapping during the post processing workflow with a separate (or combined pass). The inline tone mapping is now kept in sync with the inline color space conversion which is only intended if you render directly to screen. |
Considering your concrete use case you have to implement selective bloom differently now like any other selective (per object) FX technique. Meaning you render two beauty passes and apply the bloom to only one of them. |
Hmm...
Does this work? material.emissive.set( 1, 0, 0 );
material.emissiveIntensity = 100; |
Fixed #26346.
Description
This PR ensures the inline tone mapping can only be used when rendering to screen. Similar to
WebGLRenderer.outputColorSpace
,WebGLRenderer.toneMapping
has no effect when rendering to a render target anymore.When tone mapping is required in context of RTT,
OutputPass
/OutputShader
has to be used. This class uses nowRawShaderMaterial
which solves #26346. Meaning it compiles even whenWebGLRenderer.toneMapping
is set to something different thanTHREE.NoToneMapping
.In the next step,
OutputPass
can extract the tone mapping settings from the renderer.This PR has to be noted in the migration guide.