Skip to content

Commit f456bdb

Browse files
Tutorial 27: use PrefilteredCubeLastMip to sample environment map
1 parent 46c4ed0 commit f456bdb

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

Tutorials/Tutorial27_PostProcessing/assets/shaders/ComputeLighting.fx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ float3 ComputeSpecularIBL(float2 Location, float3 F0, float3 N, float3 V, float
7777
float3 R = reflect(-V, N);
7878
float2 BRDF_LUT = SampleBRDFIntegrationMap(float2(NdotV, Roughness));
7979
float4 SSR = g_TextureSSR.Load(int3(Location, 0));
80-
float3 T1 = SamplePrefilteredEnvironmentMap(R, Roughness * g_PBRRendererAttibs.PrefilteredCubeMipLevels);
80+
float3 T1 = SamplePrefilteredEnvironmentMap(R, Roughness * g_PBRRendererAttibs.PrefilteredCubeLastMip);
8181
float3 T2 = (F0 * BRDF_LUT.x + BRDF_LUT.yyy);
8282
return lerp(T1, SSR.rgb, SSR.w * g_Camera.f4ExtraData[0].w) * T2;
8383
}

Tutorials/Tutorial27_PostProcessing/readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ float3 ComputeSpecularIBL(float2 Location, float3 F0, float3 N, float3 V, float
233233
float3 R = reflect(-V, N);
234234
float2 BRDF_LUT = SampleBRDFIntegrationMap(float2(NdotV, Roughness));
235235
float4 SSR = g_TextureSSR.Load(int3(Location, 0));
236-
float3 T1 = SamplePrefilteredEnvironmentMap(R, Roughness * g_PBRRendererAttibs.PrefilteredCubeMipLevels);
236+
float3 T1 = SamplePrefilteredEnvironmentMap(R, Roughness * g_PBRRendererAttibs.PrefilteredCubeLastMip);
237237
float3 T2 = (F0 * BRDF_LUT.x + BRDF_LUT.yyy);
238238
return lerp(T1, SSR.rgb, SSR.w) * T2;
239239
}

Tutorials/Tutorial27_PostProcessing/src/Tutorial27_PostProcessing.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -193,12 +193,12 @@ void Tutorial27_PostProcessing::Initialize(const SampleInitInfo& InitInfo)
193193
m_ScreenSpaceReflection = std::make_unique<ScreenSpaceReflection>(m_pDevice);
194194
m_ShaderParams = std::make_unique<ShaderParams>();
195195

196-
m_ShaderParams->PBRRenderParams.OcclusionStrength = 1.0f;
197-
m_ShaderParams->PBRRenderParams.IBLScale = 1.0f;
198-
m_ShaderParams->PBRRenderParams.AverageLogLum = 0.2f;
199-
m_ShaderParams->PBRRenderParams.WhitePoint = HLSL::ToneMappingAttribs{}.fWhitePoint;
200-
m_ShaderParams->PBRRenderParams.MiddleGray = HLSL::ToneMappingAttribs{}.fMiddleGray;
201-
m_ShaderParams->PBRRenderParams.PrefilteredCubeMipLevels = static_cast<float>(m_Resources[RESOURCE_IDENTIFIER_PREFILTERED_ENVIRONMENT_MAP].AsTexture()->GetDesc().MipLevels - 1.0);
196+
m_ShaderParams->PBRRenderParams.OcclusionStrength = 1.0f;
197+
m_ShaderParams->PBRRenderParams.IBLScale = 1.0f;
198+
m_ShaderParams->PBRRenderParams.AverageLogLum = 0.2f;
199+
m_ShaderParams->PBRRenderParams.WhitePoint = HLSL::ToneMappingAttribs{}.fWhitePoint;
200+
m_ShaderParams->PBRRenderParams.MiddleGray = HLSL::ToneMappingAttribs{}.fMiddleGray;
201+
m_ShaderParams->PBRRenderParams.PrefilteredCubeLastMip = static_cast<float>(m_Resources[RESOURCE_IDENTIFIER_PREFILTERED_ENVIRONMENT_MAP].AsTexture()->GetDesc().MipLevels - 1);
202202

203203
m_ShaderParams->SSRSettings.MaxTraversalIntersections = 64;
204204
m_ShaderParams->SSRSettings.DepthBufferThickness = 0.15f;

0 commit comments

Comments
 (0)