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 does not work with orthographic projections #13838

Open
aevyrie opened this issue Jun 14, 2024 · 1 comment
Open

SSAO does not work with orthographic projections #13838

aevyrie opened this issue Jun 14, 2024 · 1 comment
Labels
A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior

Comments

@aevyrie
Copy link
Member

aevyrie commented Jun 14, 2024

Bevy version

0.13

What you did

Use an orthographic camera.

What went wrong

SSAO stopped working properly.

Additional information

This is visible in the bevy_editor_cam cad example. Switch between projections to see it.

Screen.Recording.2024-06-13.at.6.44.41.PM.mp4
@aevyrie aevyrie added C-Bug An unexpected or incorrect behavior A-Rendering Drawing game state to the screen labels Jun 14, 2024
@JMS55
Copy link
Contributor

JMS55 commented Jun 14, 2024

It's due to this

fn reconstruct_view_space_position(depth: f32, uv: vec2<f32>) -> vec3<f32> {
let clip_xy = vec2<f32>(uv.x * 2.0 - 1.0, 1.0 - 2.0 * uv.y);
let t = view.view_from_clip * vec4<f32>(clip_xy, depth, 1.0);
let view_xyz = t.xyz / t.w;
return view_xyz;
}
.

We should probably switch this to use the view transformation code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior
Projects
None yet
Development

No branches or pull requests

2 participants