Skip to content

Commit 710db87

Browse files
committed
Fix NaNs when no lights exist in scene
1 parent cedab96 commit 710db87

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

crates/bevy_solari/src/realtime/specular_gi.wgsl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,8 @@ fn nee_mis_weight(inverse_p_light: f32, brdf_rays_can_hit: bool, wo_tangent: vec
145145
let wi_tangent = vec3(dot(wi, T), dot(wi, B), dot(wi, N));
146146

147147
let p_light = 1.0 / inverse_p_light;
148-
let p_bounce = max(0.0, ggx_vndf_pdf(wo_tangent, wi_tangent, ray_hit.material.roughness));
149-
return power_heuristic(p_light, p_bounce);
148+
let p_bounce = ggx_vndf_pdf(wo_tangent, wi_tangent, ray_hit.material.roughness);
149+
return max(0.0, power_heuristic(p_light, p_bounce));
150150
}
151151

152152
// Don't adjust the size of this struct without also adjusting GI_RESERVOIR_STRUCT_SIZE.

0 commit comments

Comments
 (0)