-
-
Notifications
You must be signed in to change notification settings - Fork 56
Add support for post-processing effects #1114
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
Ready for review. I think I made a small change in the output pass (formerly flusher) causing the screenshot comparison tests to fail. |
And CI is green! |
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.
Awesome to finally have access to the depth buffer here :) looks great!
Really cool. One of the effects I’ve wanted has been a « grayscale » effect. It helps us generate assets that are 1/3 in size @claydugo and I have been playing with workarounds (mostly doing the conversion on the CPU) for the grayscale filter. |
Also some ideas for more effects: pygfx/pygfx/renderers/wgpu/engine/effectpasses.py Lines 521 to 527 in fa71a93
|
Feel like some potential for interop with existing shadertoys. Especially those that read a texture (or two for depth?) and then draw to screen. |
Yeah, I guess the post-processing effects is like Shadertoy Light (TM) 😉. They can actually have more textures as input (and also output); the base class makes no assumptions about the number of render and target textures. In terms of API, the |
Hello, Anyway, thanks for your excellent library. |
@Minigoer Good question! This is something that has crossed my mind, and which was considered in the design, but I have not addressed snapshot yet. Thanks for bringing it up. I'll add an entry in #1065. The way that post-processing is implemented, is that it pingpongs between the texture that it renders to, and an alt texture. So snapshot cannot capture the original rendered image, but it can/should capture the image including post-processing. For what it's worth, I also considered the option where snapshot captured the render result without effects, but that made the code more complex and requires an additional render texture, so I decided against it. Anyway, to fix this issue, the renderer should keep track of what the "final" texture is to take the screenshot from. In the mean time, as a workaround, you can add a |
@almarklein , it does the trick very well ! Thanks a lot ! |
EffectPass
base class.CopyPass
,NoisePass
,FogPass
,DepthPass
builtin passes.Effectpass
and is now calledOutputPass
.In ThreeJS post-processing is an addon. The API proposed here is more integrated with the renderer, making it simpler to add effects to an existing visualization.