|
|
|
|
|
|
#endif |
|
|
|
} |
|
|
|
|
|
|
|
// This function is similar to ApplyDebugToSurfaceData but for BSDFData |
|
|
|
void ApplyDebugToBSDFData(inout BSDFData bsdfData) |
|
|
|
{ |
|
|
|
#ifdef DEBUG_DISPLAY |
|
|
|
// Override value if requested by user |
|
|
|
// this can be use also in case of debug lighting mode like specular only |
|
|
|
bool overrideSpecularColor = _DebugLightingSpecularColor.x != 0.0; |
|
|
|
|
|
|
|
if (overrideSpecularColor) |
|
|
|
{ |
|
|
|
float3 overrideSpecularColor = _DebugLightingSpecularColor.yzw; |
|
|
|
bsdfData.fresnel0 = overrideSpecularColor; |
|
|
|
} |
|
|
|
#endif |
|
|
|
} |
|
|
|
|
|
|
|
SSSData ConvertSurfaceDataToSSSData(SurfaceData surfaceData) |
|
|
|
{ |
|
|
|
SSSData sssData; |
|
|
|
|
|
|
FillMaterialTransparencyData( surfaceData.baseColor, surfaceData.metallic, surfaceData.ior, surfaceData.transmittanceColor, surfaceData.atDistance, |
|
|
|
surfaceData.thickness, surfaceData.transmittanceMask, bsdfData); |
|
|
|
#endif |
|
|
|
|
|
|
|
ApplyDebugToBSDFData(bsdfData); |
|
|
|
|
|
|
|
return bsdfData; |
|
|
|
} |
|
|
|
|
|
|
// perceptualRoughness is not clamped, and is meant to be used for IBL. |
|
|
|
// perceptualRoughness can be modify by FillMaterialClearCoatData, so ConvertAnisotropyToClampRoughness must be call after |
|
|
|
ConvertAnisotropyToClampRoughness(bsdfData.perceptualRoughness, bsdfData.anisotropy, bsdfData.roughnessT, bsdfData.roughnessB); |
|
|
|
|
|
|
|
ApplyDebugToBSDFData(bsdfData); |
|
|
|
|
|
|
|
return pixelFeatureFlags; |
|
|
|
} |
|
|
|
|
|
|
// We need to make sure it's not less than the baked thickness to minimize light leaking. |
|
|
|
float thicknessDelta = max(0, thicknessInMillimeters - bsdfData.thickness); |
|
|
|
|
|
|
|
float3 S = _ShapeParams[bsdfData.diffusionProfile].rgb; |
|
|
|
float3 S = _ShapeParams[bsdfData.diffusionProfile]; |
|
|
|
|
|
|
|
// Approximate the decrease of transmittance by e^(-1/3 * dt * S). |
|
|
|
#if 0 |
|
|
|