-
-
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
Apply fog before tonemapping and encoding #26857
base: dev
Are you sure you want to change the base?
Conversation
This makes behavior more consistent between rendering to an SRGB texture and rendering to the WebGL default framebuffer. Encoding the color values should always happen after fog has been applied.
📦 Bundle sizeFull ESM build, minified and gzipped.
🌳 Bundle size after tree-shakingMinimal build including a renderer, camera, empty scene, and dependencies.
|
This would make my life a lot easier, and this solves one of the problems I'm having when porting transmission materials node-based. To work correctly, the process must work in |
I agree this is the more correct way to do things! But there will unfortunately be users with problems because they need the background to match something in HTML/CSS. I wish we had some way to apply the inverse of the tone mapping to a color, so users can at least compute a fog or background color that will give them the final background color they want. Many colors in the sRGB gamut cannot be reached by ACES tone mapping outputs though, so this would also limit your choice of background color. Perhaps AgX will be more flexible there, but I'm not sure. Or perhaps THREE.Fog could take an alpha value? |
I like the idea of rendering with |
Considering that many people use gradient backgrounds, this would fit perfectly into any HTML/CSS. three.js.examples.-.Google.Chrome.2023-09-29.14-28-11.mp4 |
Is this related to #25819? |
What are the open points in this PR? Do we need add an As mentioned earlier, the status quo is especially confusing when devs use post processing with a scene using fog. As soon as they integrate |
I'm unable to find the discussion right now... but @elalish was recently dealing with some browsers not doing alpha compositing properly. That's why I'm not sure about the transparent fog approach. |
Perhaps related ... when using post-processing: should fog be part of OutputPass, or another effect pass, rather than inline? |
Answering my own question... I think I'd prefer not putting fog into OutputPass. |
Related issue: #26208