mirror of
https://github.com/bevyengine/bevy
synced 2024-11-10 07:04:33 +00:00
Fix black spots appearing due to NANs when SSAO is enabled (#8926)
# Objective Fixes https://github.com/bevyengine/bevy/issues/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()`)
This commit is contained in:
parent
982e33741d
commit
94291cf569
1 changed files with 1 additions and 1 deletions
|
@ -20,7 +20,7 @@ fn prepass_normal(frag_coord: vec4<f32>, sample_index: u32) -> vec3<f32> {
|
|||
#else
|
||||
let normal_sample = textureLoad(view_bindings::normal_prepass_texture, vec2<i32>(frag_coord.xy), 0);
|
||||
#endif // MULTISAMPLED
|
||||
return normal_sample.xyz * 2.0 - vec3(1.0);
|
||||
return normalize(normal_sample.xyz * 2.0 - vec3(1.0));
|
||||
}
|
||||
#endif // NORMAL_PREPASS
|
||||
|
||||
|
|
Loading…
Reference in a new issue