|
|
|
|
|
|
CBUFFER_START(UnityVolumetricLighting) |
|
|
|
float4 _VBufferSampleOffset; // {x, y, z}, w = rendered frame count |
|
|
|
float4x4 _VBufferCoordToViewDirWS; // Actually just 3x3, but Unity can only set 4x4 |
|
|
|
float _CornetteShanksConstant; // CornetteShanksPhasePartConstant(_Global_Asymmetry) |
|
|
|
float _CornetteShanksConstant; // CornetteShanksPhasePartConstant(_GlobalAsymmetry) |
|
|
|
CBUFFER_END |
|
|
|
|
|
|
|
//-------------------------------------------------------------------------------------------------- |
|
|
|
|
|
|
// Sample the participating medium at 'tc' (or 'centerWS'). |
|
|
|
// We consider it to be constant along the interval [t0, t1] (within the voxel). |
|
|
|
// TODO: piecewise linear. |
|
|
|
float3 scattering = _Global_Scattering; |
|
|
|
float extinction = max(_Global_Extinction, FLT_MIN); // Avoid NaNs |
|
|
|
float asymmetry = _Global_Asymmetry; |
|
|
|
float3 scattering = _GlobalScattering; |
|
|
|
float extinction = max(_GlobalExtinction, FLT_MIN); // Avoid NaNs |
|
|
|
float asymmetry = _GlobalAsymmetry; |
|
|
|
|
|
|
|
// TODO: define a function ComputeGlobalFogCoefficients(float3 centerWS), |
|
|
|
// which allows procedural definition of extinction and scattering. |
|
|
|