Skip to content

Commit

Permalink
Fixed issue when using SSAO2 with viewports (#16146)
Browse files Browse the repository at this point in the history
Co-authored-by: David Catuhe <david@catuhe.com>
  • Loading branch information
deltakosh and David Catuhe authored Feb 5, 2025
1 parent 7621a0e commit 6f6d383
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions packages/dev/core/src/Shaders/ssaoCombine.fragment.fx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ void main(void) {

#define CUSTOM_FRAGMENT_MAIN_BEGIN

vec4 ssaoColor = texture2D(textureSampler, viewport.xy + vUV * viewport.zw);
vec4 sceneColor = texture2D(originalColor, vUV);
vec2 uv = viewport.xy + vUV * viewport.zw;
vec4 ssaoColor = texture2D(textureSampler, uv);
vec4 sceneColor = texture2D(originalColor, uv);

gl_FragColor = sceneColor * ssaoColor;

Expand Down
5 changes: 3 additions & 2 deletions packages/dev/core/src/ShadersWGSL/ssaoCombine.fragment.fx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ fn main(input: FragmentInputs) -> FragmentOutputs {

#define CUSTOM_FRAGMENT_MAIN_BEGIN

var ssaoColor: vec4f = textureSample(textureSampler, textureSamplerSampler, uniforms.viewport.xy + input.vUV * uniforms.viewport.zw);
var sceneColor: vec4f = textureSample(originalColor, originalColorSampler, input.vUV);
var uv: vec2f = uniforms.viewport.xy + input.vUV * uniforms.viewport.zw;
var ssaoColor: vec4f = textureSample(textureSampler, textureSamplerSampler, uv);
var sceneColor: vec4f = textureSample(originalColor, originalColorSampler, uv);

fragmentOutputs.color = sceneColor * ssaoColor;

Expand Down

0 comments on commit 6f6d383

Please sign in to comment.