-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
SSAO Downscale #4339
Conversation
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.
"attribute vec2 aPosition;", | ||
"", | ||
"varying vec2 vUv0;", | ||
"", | ||
"void main(void)", | ||
"{", | ||
" gl_Position = vec4(aPosition, 0.0, 1.0);", | ||
" vUv0 = (aPosition.xy + 1.0) * 0.5;", | ||
"}" |
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.
it seems this vertex shader is repeated 2-3x in this file .. perhaps store it in a variable and reuse?
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.
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.
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.
keep it is a separate PR please
If you have some performance / quality comments related to this change, please add them to the description, that'd be great to see. |
Performance at 50% scale: ~1.6x faster than 100%. |
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.