Skip to content
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

SSAO Downscale #4339

Merged
merged 2 commits into from
Jun 17, 2022
Merged

SSAO Downscale #4339

merged 2 commits into from
Jun 17, 2022

Conversation

GSterbrant
Copy link
Contributor

This PR adds downscaling to the SSAO effect, similar to #3493 but with the addition of also performing the blur pass to a downscaled target, thus reducing the pressure on texture fetches.

It also implements the resize and reaction to changing the downscaling attribute similar to the PR mentioned above, but with the addition of adding the downscale to the post-effects.tsx example.

SSAO renders first to a downscaled render target, and the blur pass also outputs to a downscaled target. A last (new) pass outputs the final value to the output target.
The SSAO script handles window resizing as well as changing the downscale value on-the-fly.
Comment on lines +368 to +376
"attribute vec2 aPosition;",
"",
"varying vec2 vUv0;",
"",
"void main(void)",
"{",
" gl_Position = vec4(aPosition, 0.0, 1.0);",
" vUv0 = (aPosition.xy + 1.0) * 0.5;",
"}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it seems this vertex shader is repeated 2-3x in this file .. perhaps store it in a variable and reuse?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am actually working on adding a createVertexShader for post effects so we can reuse it everywhere. It seems this code is the same for every post effect, so it would make sense to have it declared in a single place and reused across multiple post effects. I will add it to this PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keep it is a separate PR please

@mvaligursky
Copy link
Contributor

If you have some performance / quality comments related to this change, please add them to the description, that'd be great to see.

@GSterbrant
Copy link
Contributor Author

Performance at 50% scale: ~1.6x faster than 100%.

@GSterbrant GSterbrant merged commit 681713d into main Jun 17, 2022
@GSterbrant GSterbrant deleted the gsterbrant_ssao_downscale branch June 17, 2022 09:32
@mvaligursky mvaligursky mentioned this pull request Jun 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants