浏览代码

Clean up the shader a bit

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

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


return /* 0.25 * */ S * (expOneThird + expOneThird * expOneThird * expOneThird);
}
// Computes F(x)/P(x), s.t. x = sqrt(r^2 + z^2).
float3 ComputeBilateralWeight(float3 S, float r, float z, float rcpDistScale, float rcpPdf)
// Computes F(x)/P(x), s.t. x = sqrt(r^2 + t^2).
float3 ComputeBilateralWeight(float3 S, float r, float t, float rcpDistScale, float rcpPdf)
float3 valX = KernelValCircle(sqrt(r * r + z * z) * rcpDistScale, S);
float3 valX = KernelValCircle(sqrt(r * r + t * t) * rcpDistScale, S);
float rcpPdfX = rcpPdf * (1 + abs(z) / r);
float rcpPdfX = rcpPdf * (1 + abs(t) / r);
return valX * rcpPdfX;
}

\
float2 position = centerPosUnSS + vec * scaledPixPerMm; \
float rcpPdf = kernel[profileID][i][1]; \
float depth = LOAD_TEXTURE2D(_MainDepthTexture, position).r; \
/* TODO: see if making this a [branch] improves performance. */ \
float d = LinearEyeDepth(depth, _ZBufferParams); \
float z = millimPerUnit * d - (millimPerUnit * centerDepthVS); \
float3 w = ComputeBilateralWeight(shapeParam, r, z, rcpDistScale, rcpPdf); \
float z = LOAD_TEXTURE2D(_MainDepthTexture, position).r; \
float d = LinearEyeDepth(z, _ZBufferParams); \
float t = millimPerUnit * d - (millimPerUnit * centerDepthVS); \
float3 w = ComputeBilateralWeight(shapeParam, r, t, rcpDistScale, rcpPdf); \
\
totalIrradiance += w * irradiance; \
totalWeight += w; \

正在加载...
取消
保存