|
|
|
|
|
|
// Returns fog color in rgb and fog factor in alpha. |
|
|
|
float4 EvaluateAtmosphericScattering(PositionInputs posInput) |
|
|
|
{ |
|
|
|
float3 fogColor = 0; |
|
|
|
float fogFactor = 0; |
|
|
|
|
|
|
|
return SampleInScatteredRadianceAndTransmittance(TEXTURE3D_PARAM(_VBufferLighting, s_trilinear_clamp_sampler), |
|
|
|
posInput.positionNDC, posInput.linearDepth, |
|
|
|
_VBufferResolution, _VBufferScaleAndSliceCount, |
|
|
|
_VBufferDepthEncodingParams); |
|
|
|
#endif |
|
|
|
float4 volFog = SampleInScatteredRadianceAndTransmittance(TEXTURE3D_PARAM(_VBufferLighting, s_trilinear_clamp_sampler), |
|
|
|
posInput.positionNDC, posInput.linearDepth, |
|
|
|
_VBufferResolution, _VBufferScaleAndSliceCount, |
|
|
|
_VBufferDepthEncodingParams); |
|
|
|
fogColor = volFog.rgb; |
|
|
|
fogFactor = 1 - volFog.a; |
|
|
|
float3 fogColor; float fogFactor; |
|
|
|
#else |
|
|
|
|
|
|
|
if (_AtmosphericScatteringType == FOGTYPE_EXPONENTIAL) |
|
|
|
{ |
|
|
|
|
|
|
} |
|
|
|
else // NONE |
|
|
|
{ |
|
|
|
return float4(0.0, 0.0, 0.0, 0.0); |
|
|
|
#endif |
|
|
|
|
|
|
|
return float4(fogColor, fogFactor); |
|
|
|
} |