From 5c11ded6c95a6ca5e0b8008dccdc461e22b02ca5 Mon Sep 17 00:00:00 2001 From: Aevyrie Date: Wed, 3 Jan 2024 01:02:50 -0800 Subject: [PATCH] Apply review feedback --- crates/bevy_pbr/src/deferred/deferred_lighting.wgsl | 4 ++-- crates/bevy_pbr/src/render/pbr_fragment.wgsl | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/bevy_pbr/src/deferred/deferred_lighting.wgsl b/crates/bevy_pbr/src/deferred/deferred_lighting.wgsl index fa9cde9cf2183..c8182362cd253 100644 --- a/crates/bevy_pbr/src/deferred/deferred_lighting.wgsl +++ b/crates/bevy_pbr/src/deferred/deferred_lighting.wgsl @@ -72,8 +72,8 @@ fn fragment(in: FullscreenVertexOutput) -> @location(0) vec4 { var perceptual_roughness: f32 = pbr_input.material.perceptual_roughness; let roughness = lighting::perceptualRoughnessToRoughness(perceptual_roughness); - // Use ssao to estimate the specular occlusion. [Lagarde et al., 2014] - pbr_input.specular_occlusion = clamp(pow(NdotV + ssao, exp2(-16.0 * roughness - 1.0)) - 1.0 + ssao, 0.0, 1.0); + // Use SSAO to estimate the specular occlusion. [Lagarde et al., 2014] + pbr_input.specular_occlusion = saturate(pow(NdotV + ssao, exp2(-16.0 * roughness - 1.0)) - 1.0 + ssao); #endif // SCREEN_SPACE_AMBIENT_OCCLUSION output_color = pbr_functions::apply_pbr_lighting(pbr_input); diff --git a/crates/bevy_pbr/src/render/pbr_fragment.wgsl b/crates/bevy_pbr/src/render/pbr_fragment.wgsl index 1e81eedd4cffb..3151fea42b1a2 100644 --- a/crates/bevy_pbr/src/render/pbr_fragment.wgsl +++ b/crates/bevy_pbr/src/render/pbr_fragment.wgsl @@ -175,8 +175,8 @@ fn pbr_input_from_standard_material( let ssao = textureLoad(screen_space_ambient_occlusion_texture, vec2(in.position.xy), 0i).r; let ssao_multibounce = gtao_multibounce(ssao, pbr_input.material.base_color.rgb); diffuse_occlusion = min(diffuse_occlusion, ssao_multibounce); - // Use ssao to estimate the specular occlusion. [Lagarde et al., 2014] - specular_occlusion = clamp(pow(NdotV + ssao, exp2(-16.0 * roughness - 1.0)) - 1.0 + ssao, 0.0, 1.0); + // Use SSAO to estimate the specular occlusion. [Lagarde et al., 2014] + specular_occlusion = saturate(pow(NdotV + ssao, exp2(-16.0 * roughness - 1.0)) - 1.0 + ssao); #endif pbr_input.diffuse_occlusion = diffuse_occlusion; pbr_input.specular_occlusion = specular_occlusion;