-
-
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
Examples: Port advanced postprocessing sample to WebGPU #28962
base: dev
Are you sure you want to change the base?
Conversation
I would be inclined not to bring a GammaCorrectionNode into the WebGPU renderer and TSL, as we already have ColorSpaceNode. |
Yes, no need for separate nodes.
@sunag already wrote code for that in another example. It is so simple that I don't think we need a separate node.
|
It might make more sense to port https://threejs.org/examples/webgl_postprocessing_masking first before thinking about the advanced example. I'm also not sure yet if we want to use the same masking approach as before. The design maybe needs to be revisited. |
I agree. There are several ways to do this with MRT, it could be something like |
Yeah, I was hoping we can get a solution without the stencil buffer. The related handling was always a bit inconvenient. |
Not having to manage setting and clearing masks with the stencil sounds good to me, especially for a simple post step. |
Question for @sunag: In the mrt_mask example, when the mrtNode of the scenePass is set to vec4(0), but the mrtNode of the mesh material is set to output, would this generally mean that the alpha of every pixel outside of the mesh itself is 0, while every alpha of the pixel within the mesh is 1? Seems like alpha blending would be the solution here ( especially for post-processing), but need a better understanding of how the mrt system works. |
A MRT used in For example in // global
const scenePass = pass( scene, camera );
scenePass.setMRT( mrt( {
output,
bloomIntensity: float( 0 ) // default bloom intensity
} ) );
// define a custom bloom intensity in some material
material.mrtNode = mrt( {
bloomIntensity: float( 1.0 ) // it could be: output.a
} ); Note that |
If alpha is not considered in the output of a pass, then how could I get the alpha output of a scene? |
I assume you want to transfer the alpha output of scene to an individual texture using MRT: scenePass.setMRT( mrt( {
output,
sceneAlpha: output.a
} ) ); |
29784cc
to
1c52d66
Compare
What is missing to complete this PR? |
Sorry I didn't have time to respond earlier. I think just a colorify implementation and then implementing the sample. I was having some issues creating multiple postProcessing objects that only apply to a specific subsection of the screen, but I'll have to check if that's still a problem. |
1c52d66
to
209b199
Compare
📦 Bundle sizeFull ESM build, minified and gzipped.
🌳 Bundle size after tree-shakingMinimal build including a renderer, camera, empty scene, and dependencies.
|
I agree it's super simple but it's nice to have also"basic node" part of threejs, it make the postprocessing super easy to setup in a new project without having to dive into TSL and redo the wheel, Vignette is one of the must use pass i saw in almost all project a bit cinematic. |
Related issue:
Description
Long-term goal to port over webgl_postprocessing_advanced and its relevant shaders over to a WebGPURenderer version. We can also determine whether some of these smaller shaders warrant being included with the build or should be relegated to the examples
webgpu_postprocessing_masking
#29016