浏览代码

Add analytical transmittance integration

/main
Evgenii Golubev 7 年前
当前提交
f24c6a35
共有 2 个文件被更改,包括 20 次插入3 次删除
  1. 10
      ScriptableRenderPipeline/Core/ShaderLibrary/VolumeRendering.hlsl
  2. 13
      ScriptableRenderPipeline/HDRenderPipeline/Lighting/Volumetrics/Resources/VolumetricLighting.compute

10
ScriptableRenderPipeline/Core/ShaderLibrary/VolumeRendering.hlsl


return exp(-opticalDepth);
}
float TransmittanceIntegralOverHomogeneousInterval(float extinction, float start, float end)
{
return (exp(-extinction * start) - exp(-extinction * end)) / extinction;
}
float3 OpticalDepthHomogeneous(float3 extinction, float intervalLength)
{
return extinction * intervalLength;

{
return exp(-opticalDepth);
}
float3 TransmittanceIntegralOverHomogeneousInterval(float3 extinction, float start, float end)
{
return (exp(-extinction * start) - exp(-extinction * end)) / extinction;
}
float IsotropicPhaseFunction()

13
ScriptableRenderPipeline/HDRenderPipeline/Lighting/Volumetrics/Resources/VolumetricLighting.compute


float du = rcp(numSteps);
float u0 = 0.25 * du + 0.5 * du * zeta;
float dt = du * ray.maxLength;
float t0 = 0;
float u = u0 + s * du; // [0, 1]
float t = u * ray.maxLength; // [0, ray.maxLength]
float u = u0 + s * du; // [0, 1]
float t = u * ray.maxLength; // [0, ray.maxLength]
float t1 = t + 0.5 * dt;
float T = TransmittanceIntegralOverHomogeneousInterval(extinction, t0, t1);
[branch] if (T < 0.0001) break;
float3 positionWS = ray.originWS + t * ray.directionWS;

}
}
radiance += sampleRadiance * (Transmittance(OpticalDepthHomogeneous(extinction, t)) * dt);
radiance += sampleRadiance * T;
t0 = t1;
}
#ifdef USE_HENYEY_GREENSTEIN_PHASE_FUNCTION
float3 phaseConstant = scattering * HenyeyGreensteinPhasePartConstant(asymmetry);

正在加载...
取消
保存