|
|
|
|
|
|
float2 centerPosition = posInput.unPositionSS; |
|
|
|
float3 centerIrradiance = LOAD_TEXTURE2D(_IrradianceSource, centerPosition).rgb; |
|
|
|
|
|
|
|
float maxDistInPixels = maxDistance * min(FLT_MAX, max(scaledPixPerMm.x, scaledPixPerMm.y)); |
|
|
|
float maxDistInPixels = maxDistance * max(scaledPixPerMm.x, scaledPixPerMm.y); |
|
|
|
if (maxDistInPixels < 1) |
|
|
|
if (distScale == 0 || maxDistInPixels < 1) |
|
|
|
{ |
|
|
|
#if SSS_DEBUG |
|
|
|
return float4(0, 0, 1, 1); |
|
|
|
|
|
|
// We perform point sampling. Therefore, we can avoid the cost |
|
|
|
// of filtering if we stay within the bounds of the current pixel. |
|
|
|
// We use the value of 1 instead of 0.5 as an optimization. |
|
|
|
float maxDistInPixels = scaledStepSize * min(FLT_MAX, maxDistance); |
|
|
|
float maxDistInPixels = scaledStepSize * maxDistance; |
|
|
|
if (maxDistInPixels < 1) |
|
|
|
if (distScale == 0 || maxDistInPixels < 1) |
|
|
|
{ |
|
|
|
return float4(bsdfData.diffuseColor * sampleIrradiance, 1); |
|
|
|
} |
|
|
|
|
|
|
// We do not terminate the loop since we want to gather the contribution |
|
|
|
// of the remaining samples (e.g. in case of hair covering skin). |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
#endif |
|
|
|
|
|
|
|