|
|
|
|
|
|
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; \ |
|
|
|