-
-
Notifications
You must be signed in to change notification settings - Fork 36k
WebGPURenderer: Volumetric lighting #30530
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
Conversation
📦 Bundle sizeFull ESM build, minified and gzipped.
🌳 Bundle size after tree-shakingMinimal build including a renderer, camera, empty scene, and dependencies.
|
I'm still improving! |
The new demos really look stunning! This is awesome stuff 🙌 . |
Thank you @Mugen87 ❤️
Maybe this will cause regression, and then we could solve it with a parameter in the renderer, we could even share the objects that have passed through the frustrum using this new parameter 🤔 |
You're a legend - That looks beautiful |
|
||
let bayer16Texture = null; | ||
|
||
export const bayer16 = Fn( ( [ uv ] ) => { |
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.
Currently writing the docs for this module...
What is this TSL function about? I've tried to find some references about "Bayer16" but without success.
Is this an alternative noise texture? I know the term "Bayer" only from Bayer Filters in context of image sensors but I don't understand how it relates to this code.
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.
Bayer Matrix is a pattern, it is used for dithering effects as well, but in this case it was used as an alternative to blue-noise. I use bayer16
which is a 16x16 texture with the bayer pattern, when used in Ray Marching specifically in VolumeNodeMaterial.offsetNode
, it reduces banding
problem, thus being able to use fewer steps
without affecting the visuals as much.
Description
The PR introduces volumetric lighting compatible with native Three.js lighting. Some improvements were needed to the lighting system, the next step now is to normalize the changes to work in the other examples.
Volumetric lighting can be executed in the same rendering pass, but when used in post-processing we can use some denoising approach and improve performance by reducing the resolution of the ray-marching buffer.
Currently fog density is related only to additive blending, that's why volumetric lighting instead of volumetric fog, but I have plans to support normal blending for other fog effects.
Shadow calculations are now shared across passes if the camera is the same as the one used. We may need to review how to relate the shadow map to the camera used to avoid duplicate calculations if reflectors are also used.
I found
bayer16
s idea interesting where we have a relatively large matrix that we can load as a TSL function.It's a WIP, revisions and docs would be created in the next few days.
Live example