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

Black spots when using SSAO #8925

Closed
Elabajaba opened this issue Jun 22, 2023 · 0 comments · Fixed by #8926
Closed

Black spots when using SSAO #8925

Elabajaba opened this issue Jun 22, 2023 · 0 comments · Fixed by #8926
Labels
A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior

Comments

@Elabajaba
Copy link
Contributor

Bevy version

Bevy main, commit ee1368a.
Started with 72b4aac (fix normal prepass #8890)

Relevant system information

 AdapterInfo { name: "AMD Radeon RX 6800 XT", vendor: 4098, device: 29631, device_type: DiscreteGpu, driver: "AMD proprietary driver", driver_info: "23.5.2 (AMD proprietary shader compiler)", backend: Vulkan }

Also occurs on dx12.

What you did

Run the ssao example (in both debug and release mode)

What went wrong

image

Checking with renderdoc, the black spot is NANs that happen during the main opaque pass. This seems to only happen when SSAO is enabled on the camera (using ScreenSpaceAmbientOcclusionBundle), but still appears even when SSAO is turned off (by removing the ScreenSpaceAmbientOcclusionSettings component from the camera, leaving the DepthPrepass and NormalPrepass components on the camera).

Additional information

TODO

@Elabajaba Elabajaba added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Jun 22, 2023
@Selene-Amanita Selene-Amanita added A-Rendering Drawing game state to the screen and removed S-Needs-Triage This issue needs to be labelled labels Jun 22, 2023
github-merge-queue bot pushed a commit that referenced this issue Jul 1, 2023
# Objective

Fixes #8925

## Solution

~~Clamp the bad values.~~

Normalize the prepass normals when we get them in the `prepass_normal()`
function.

## More Info

The issue is that NdotV is sometimes very slightly greater than 1 (maybe
FP rounding issues?), which caused `F_Schlick()` to return NANs in
`pow(1.0 - NdotV, 5.0)` (call stack looked like`pbr()` ->
`directional_light()` -> `Fd_Burley()` -> `F_Schlick()`)
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

Successfully merging a pull request may close this issue.

2 participants