|
|
|
|
|
|
#define SHADERPASS SHADERPASS_VOLUMETRIC_LIGHTING |
|
|
|
#define GROUP_SIZE_1D 16 |
|
|
|
#define GROUP_SIZE_2D (GROUP_SIZE_1D * GROUP_SIZE_1D) |
|
|
|
// #define USE_HENYEY_GREENSTEIN_PHASE_FUNCTION |
|
|
|
|
|
|
|
//-------------------------------------------------------------------------------------------------- |
|
|
|
// Included headers |
|
|
|
|
|
|
{ |
|
|
|
float3 scattering = _GlobalFog_Scattering; |
|
|
|
float extinction = _GlobalFog_Extinction; |
|
|
|
#ifdef USE_HENYEY_GREENSTEIN_PHASE_FUNCTION |
|
|
|
#endif |
|
|
|
|
|
|
|
LightLoopContext context; |
|
|
|
// ZERO_INITIALIZE(LightLoopContext, context); |
|
|
|
|
|
|
float intensity = 1; |
|
|
|
float3 color = lightData.color; |
|
|
|
|
|
|
|
#ifdef USE_HENYEY_GREENSTEIN_PHASE_FUNCTION |
|
|
|
#endif |
|
|
|
|
|
|
|
[branch] if (lightData.shadowIndex >= 0) |
|
|
|
{ |
|
|
|
|
|
|
float intensity = GetPunctualShapeAttenuation(lightData, L, distSq); |
|
|
|
float3 color = lightData.color; |
|
|
|
|
|
|
|
#ifdef USE_HENYEY_GREENSTEIN_PHASE_FUNCTION |
|
|
|
#endif |
|
|
|
intensity *= Transmittance(OpticalDepthHomogeneous(extinction, dist)); |
|
|
|
|
|
|
|
[branch] if (lightData.shadowIndex >= 0) |
|
|
|
|
|
|
|
|
|
|
radiance += sampleRadiance * (Transmittance(OpticalDepthHomogeneous(extinction, t)) * dt); |
|
|
|
} |
|
|
|
|
|
|
|
#ifdef USE_HENYEY_GREENSTEIN_PHASE_FUNCTION |
|
|
|
#else |
|
|
|
float3 phaseConstant = scattering * IsotropicPhaseFunction(); |
|
|
|
#endif |
|
|
|
return radiance * phaseConstant; |
|
|
|
} |
|
|
|
|
|
|
|