|
|
|
|
|
|
float alpha = GetSurfaceData(input, layerTexCoord, surfaceData, normalTS, bentNormalTS); |
|
|
|
GetNormalWS(input, V, normalTS, surfaceData.normalWS); |
|
|
|
|
|
|
|
// Ensure that the normal is front-facing. |
|
|
|
float NdotV; |
|
|
|
surfaceData.normalWS = GetViewReflectedNormal(surfaceData.normalWS, V, NdotV); |
|
|
|
|
|
|
|
// Use bent normal to sample GI if available |
|
|
|
#ifdef _BENTNORMALMAP |
|
|
|
GetNormalWS(input, V, bentNormalTS, bentNormalWS); |
|
|
|
|
|
|
// If we have bent normal and ambient occlusion, process a specular occlusion |
|
|
|
surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData); |
|
|
|
#elif defined(_MASKMAP) |
|
|
|
surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(NdotV, surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); |
|
|
|
surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(dot(surfaceData.normalWS, V), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); |
|
|
|
#else |
|
|
|
surfaceData.specularOcclusion = 1.0; |
|
|
|
#endif |
|
|
|