浏览代码

Improve handling of the radius of 0

/RenderPassXR_Sandbox
Evgenii Golubev 8 年前
当前提交
ad52d33f
共有 1 个文件被更改,包括 5 次插入5 次删除
  1. 10
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Resources/CombineSubsurfaceScattering.shader

10
Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Resources/CombineSubsurfaceScattering.shader


float3 shapeParam = _ShapeParams[profileID].rgb;
float maxDistance = _ShapeParams[profileID].a;
#else
float maxDistance = _FilterKernelsBasic[profileID][SSS_BASIC_N_SAMPLES - 1].a;
float maxDistance = _FilterKernelsBasic[profileID][SSS_BASIC_N_SAMPLES - 1].a;
#endif
// Reconstruct the view-space position.

float2 centerPosition = posInput.unPositionSS;
float3 centerIrradiance = LOAD_TEXTURE2D(_IrradianceSource, centerPosition).rgb;
float maxDistInPixels = maxDistance * max(scaledPixPerMm.x, scaledPixPerMm.y);
float maxDistInPixels = maxDistance * min(FLT_MAX, max(scaledPixPerMm.x, scaledPixPerMm.y));
if (distScale == 0 || maxDistInPixels < 1)
if (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 * maxDistance;
float maxDistInPixels = scaledStepSize * min(FLT_MAX, maxDistance);
if (distScale == 0 || maxDistInPixels < 1)
if (maxDistInPixels < 1)
{
return float4(bsdfData.diffuseColor * sampleIrradiance, 1);
}

正在加载...
取消
保存