-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Refactored the grab pass and scene depth rendering #4244
Conversation
Hello, How to get the old behaviour for the color buffer? In some of my projects, I'm using shaders to blend UI sprites with custom functions (similar to photoshop blend modes) so I need the current color buffer when rendering the sprite, not one captured some time before because as those sprites can overlap they're now cancelling each other instead of stacking. |
@NewboO - Unfortunately we don't have a support for this anymore. For multiple reason, this has been removed for now. We will consider having this as an option in the future, but most likely not very immediately. |
@NewboO, would you be able to share an example shader that no longer works? Perhaps we can provide an alternative path? |
Here's a sample project: https://playcanvas.com/project/950042/overview/color-buffer And here's how it looks with previous engine version: https://launch.playcanvas.com/1456173?debug=true&version=1.53.4 Now with current engine it gives this: https://launch.playcanvas.com/1456173?debug=true This is a very basic example with only a difference blending on a single layer but I'd like to be able to do this kind of thing with more complex blending formulas on any layer. |
I think a possible way to do something like this would be to create multiple render targets .. and swap rendering between them, so that you can use what was already rendered to as a texture for following rendering. Not as convenient, especially if this is in 3D with dynamically changing orders unfortunately, so more of a limited case solution I'd say. |
An update if anyone else than me is interested in getting the old behaviour: the best workaround I found was to duplicate the SceneGrab code I need and call it in a custom Layer.onDrawCall function. It's not perfect but good enough for my use cases and it doesn't require juggling with render targets. My sample project is updated with a dirty PoC showing both behaviours. |
Fixes: #4090
Related: #2953
This PR refactors and improved both grab pass functionality, as well as the scene depth rendering. Files grab-pass.js and scene-depth.js were refactored into scene-grab.js. The main motivation is to minimize number of resolves and buffer copies taking place, and keeping to more formal render pass implementation required for webGPU.
Shared changes
Changes to grab-pass
Changes to depth pass