|
|
|
|
|
|
float t0 = ray.strataDirInvViewZ * z0; // Convert view space Z to distance along the stratified ray |
|
|
|
float de = rcp(VBUFFER_SLICE_COUNT); // Log-encoded distance between slices |
|
|
|
|
|
|
|
// The contribution of the ambient probe does not depend on the position, |
|
|
|
// only on the direction and the length of the interval. |
|
|
|
float3 probeInScatteredRadiance = EvaluateLightProbe(GetPreconvolvedAmbientProbe(), ray.centerDirWS); |
|
|
|
|
|
|
|
float3 totalRadiance = 0; |
|
|
|
float opticalDepth = 0; |
|
|
|
|
|
|
|
|
|
|
float phase = IsotropicPhaseFunction(); |
|
|
|
#endif |
|
|
|
|
|
|
|
// Sample the light probe. |
|
|
|
float3 probeRadiance = EvaluateLightProbe(GetPreconvolvedAmbientProbe(), ray.centerDirWS) * TransmittanceIntegralHomogeneousMedium(extinction, dt); |
|
|
|
|
|
|
|
// Integrate the contribution of the probe over the interval. |
|
|
|
float3 probeRadiance = probeInScatteredRadiance * TransmittanceIntegralHomogeneousMedium(extinction, dt); |
|
|
|
|
|
|
|
totalRadiance += transmittance * scattering * (phase * blendedRadiance + probeRadiance); |
|
|
|
|
|
|
|
// Compute the optical depth up to the center of the interval. |
|
|
|