-
-
Notifications
You must be signed in to change notification settings - Fork 21.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
Move screen space effects into a separate class #62478
Move screen space effects into a separate class #62478
Conversation
52e7b64
to
fe5fe91
Compare
@Calinou if you have some good test scenes to test these with, can you give this PR a twirl? I think I've got everything working correctly but I've only tested screen space reflection properly so far. |
e8f8186
to
363f32e
Compare
Tested on https://github.com/godotengine/godot/files/7854794/test_ssil_3.zip, with SSAO, SSR and SSIL enabled at the same time. I confirm this PR works as expected on both clustered and mobile1 backends. It also fixes #62525 even when this PR is rebased against latest However, this PR doesn't fix #56724 or #50151 – SSIL and SSR artifacts are still common when resizing the viewport. Footnotes
|
771c001
to
655fa32
Compare
This PR is pretty much done except for:
Setting this to "ready for review" as all the other work can be checked and fixing SSR for stereoscopic can be moved to a separate PR. |
Found a little more I want to do around SSIL and SSAO |
655fa32
to
bb0c8e7
Compare
Allocation of buffers for SSAO is now moved from With all buffers in our |
I tested the latest revision of this PR on the above MRP and it still works as expected. 👍 |
bb0c8e7
to
75d8b84
Compare
Made the same change to SSIL, pretty happy about the cleanup this gives, nearly all logic around SSIL, SSAO and SSR is now contained in this class. Really the only bit that we can't make modular is the shader code that is in the scene shader. |
My general thinking is that I am still not sure the array approach makes more sense for compute multiview, it makes code harder to read, harder to test if you don't have multiview and for compute there is zero difference between doing 1 call or two, or three. And there is zero effort in just creating the individual textures to pass to the effects if you want to run them more than once. I would be much happier if the compute shaders had no idea about what multiview is and this was handled entirely from C++. |
I think for practical reasons, we really should do away with it everywhere it makes sense. Otherwise think that contributors who don't care about multiview (the vast majority) that want to tinker with shader will have a very hard time testing to see if these work (or just plain ignore that side of the shader) resulting in more breakage for the multiview users, because honestly we cant expect that every change to a shader needs to be tested in multiview. In fact, if going forward we implement things like an easier to use post processing architecture using compute, we need to make sure that it can go transparently to multiview without the developer interaction, otherwise it will be very hard to ensure it works there and XR users will complain that this is not supported or not tested. Unlike C++ these errors are not catched at compile time since we dont even plan on compiling those shaders when not in use. In the end, you will get the opposite effect to what you want, multiview will be a burden to other developers and/or will break a lot more often. So IMO, I would really make the rendering code the least multiview centric as possible. At much require the function to operate on array of buffers (separate elements) but not texture arrays. The least invasive multiview changes are, the more chances it has that it will be well supported and not break because the reality is that most developers don't care about it. Multiview code needs to be written with this mindset, making sure it works but not ever expecting to take center stage. |
@reduz indeed, my main concern was one of performance whether there is overhead in performing the same action twice. However with screen space effects where we're still performing both passes in the same command queue there doesn't seem to be a difference. I think the only two things we can't get away from when rendering stereo:
|
75d8b84
to
a51cf9c
Compare
a51cf9c
to
6b1d528
Compare
@BastiaanOlij You have to think of Compute as something that processes little blocks of data on demand. If you do two calls to it (and not barrier the calls) its exactly the same as doing one for both since you just keep the GPU busy doing what it has to do. |
would still wait on @clayjohn approval since this touches a lot of his code. |
@reduz ok, I did add the bariers in this case because I'm processing one eye at a time so we don't have to double the sizes of all the buffers. In this case I wonder if it would make much difference seeing plenty is done in parallel already. But maybe reshuffling and making all intermediate buffers have 2 layers would allow us an improvement here? |
Performance comparison between
|
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.
Looks fine to me. I noticed that there are a lot of VRS changes that have been commented out, are those just placeholders for now? Or is it dead code that should be removed?
6b1d528
to
dfc87db
Compare
dfc87db
to
eefcb5e
Compare
I've removed these. I think this is ready now |
Thanks! |
Moving screen space effects into their own effects class. Includes:
SSIL and SSAO do not have stereoscopic support, will deal with this in a separate PR.
SSR stereoscopic support is not working yet, still debugging the issue.
Everything else is working.