Fixed up issues with my prior occlusion changes, after merging latest main, got everything working again.
ATOM-14040 Add Support for Cavity Maps
This commit is contained in:
@@ -213,9 +213,8 @@ PbrLightingOutput ForwardPassPS_Common(VSOutput IN, bool isFrontFace, out float
|
||||
|
||||
// ------- Occlusion -------
|
||||
|
||||
float diffuseAmbientOcclusion = GetOcclusionInput(MaterialSrg::m_diffuseOcclusionMap, MaterialSrg::m_sampler, IN.m_uv[MaterialSrg::m_diffuseOcclusionMapUvIndex], MaterialSrg::m_diffuseOcclusionFactor, o_diffuseOcclusion_useTexture);
|
||||
float specularOcclusion = GetOcclusionInput(MaterialSrg::m_specularOcclusionMap, MaterialSrg::m_sampler, IN.m_uv[MaterialSrg::m_specularOcclusionMapUvIndex], MaterialSrg::m_specularOcclusionFactor, o_specularOcclusion_useTexture);
|
||||
|
||||
lightingData.diffuseAmbientOcclusion = GetOcclusionInput(MaterialSrg::m_diffuseOcclusionMap, MaterialSrg::m_sampler, IN.m_uv[MaterialSrg::m_diffuseOcclusionMapUvIndex], MaterialSrg::m_diffuseOcclusionFactor, o_diffuseOcclusion_useTexture);
|
||||
lightingData.specularOcclusion = GetOcclusionInput(MaterialSrg::m_specularOcclusionMap, MaterialSrg::m_sampler, IN.m_uv[MaterialSrg::m_specularOcclusionMapUvIndex], MaterialSrg::m_specularOcclusionFactor, o_specularOcclusion_useTexture);
|
||||
|
||||
// ------- Clearcoat -------
|
||||
|
||||
|
||||
+6
-2
@@ -47,8 +47,10 @@ class LightingData
|
||||
// Normal . View
|
||||
float NdotV;
|
||||
|
||||
// Occlusion factors
|
||||
// 0 = dark, 1 = light
|
||||
float occlusion;
|
||||
float diffuseAmbientOcclusion;
|
||||
float specularOcclusion;
|
||||
|
||||
void Init(float3 positionWS, float3 normal, float roughnessLinear);
|
||||
void CalculateMultiscatterCompensation(float3 specularF0, bool enabled);
|
||||
@@ -62,7 +64,8 @@ void LightingData::Init(float3 positionWS, float3 normal, float roughnessLinear)
|
||||
translucentBackLighting = 0;
|
||||
multiScatterCompensation = 1.0f;
|
||||
emissiveLighting = float3(0.0f, 0.0f, 0.0f);
|
||||
occlusion = 1.0f;
|
||||
diffuseAmbientOcclusion = 1.0f;
|
||||
specularOcclusion = 1.0f;
|
||||
|
||||
dirToCamera = normalize(ViewSrg::m_worldPosition.xyz - positionWS);
|
||||
|
||||
@@ -79,6 +82,7 @@ void LightingData::CalculateMultiscatterCompensation(float3 specularF0, bool ena
|
||||
|
||||
void LightingData::FinalizeLighting(float3 transmissionTint)
|
||||
{
|
||||
specularLighting *= specularOcclusion;
|
||||
specularLighting += emissiveLighting;
|
||||
|
||||
// Transmitted light
|
||||
|
||||
+2
-5
@@ -45,8 +45,8 @@ PbrLightingOutput GetPbrLightingOutput(Surface surface, LightingData lightingDat
|
||||
|
||||
// albedo, specularF0, roughness, and normals for later passes (specular IBL, Diffuse GI, SSR, AO, etc)
|
||||
lightingOutput.m_specularF0 = float4(surface.specularF0, surface.roughnessLinear);
|
||||
lightingOutput.m_albedo.rgb = surface.albedo * lightingData.diffuseResponse;
|
||||
lightingOutput.m_albedo.a = lightingData.occlusion;
|
||||
lightingOutput.m_albedo.rgb = surface.albedo * lightingData.diffuseResponse * lightingData.diffuseAmbientOcclusion;
|
||||
lightingOutput.m_albedo.a = lightingData.specularOcclusion;
|
||||
lightingOutput.m_normal.rgb = EncodeNormalSignedOctahedron(surface.normal);
|
||||
lightingOutput.m_normal.a = o_specularF0_enableMultiScatterCompensation ? 1.0f : 0.0f;
|
||||
|
||||
@@ -58,6 +58,3 @@ PbrLightingOutput GetPbrLightingOutput(Surface surface, LightingData lightingDat
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -109,7 +109,8 @@ PbrLightingOutput PbrLighting( VSOutput IN,
|
||||
lightingData.Init(surface.position, surface.normal, surface.roughnessLinear);
|
||||
|
||||
lightingData.emissiveLighting = emissive;
|
||||
lightingData.occlusion = occlusion;
|
||||
lightingData.diffuseAmbientOcclusion = diffuseAmbientOcclusion;
|
||||
lightingData.specularOcclusion = specularOcclusion;
|
||||
|
||||
// Directional light shadow coordinates
|
||||
lightingData.shadowCoords = shadowCoords;
|
||||
|
||||
@@ -76,7 +76,7 @@ void ApplyIBL(Surface surface, inout LightingData lightingData)
|
||||
|
||||
// Adjust IBL lighting by exposure.
|
||||
float iblExposureFactor = pow(2.0, SceneSrg::m_iblExposure);
|
||||
lightingData.diffuseLighting += (iblDiffuse * iblExposureFactor * lightingData.occlusion);
|
||||
lightingData.diffuseLighting += (iblDiffuse * iblExposureFactor * lightingData.diffuseAmbientOcclusion);
|
||||
lightingData.specularLighting += (iblSpecular * iblExposureFactor);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user