|
|
|
|
|
|
uniform float _MiePhaseAnisotropy; |
|
|
|
uniform float _MieExtinctionFactor; |
|
|
|
|
|
|
|
SAMPLER2D(sampler_MainDepthTexture); |
|
|
|
TEXTURE2D_FLOAT(_MainDepthTexture); |
|
|
|
TEXTURE2D(_OcclusionTexture); |
|
|
|
|
|
|
|
float HenyeyGreensteinPhase(float g, float cosTheta) { |
|
|
|
|
|
|
|
|
|
|
void VolundTransferScatter(float3 worldPos, out float4 coords1, out float4 coords2, out float4 coords3) { |
|
|
|
const float3 scaledWorldPos = WorldScale(worldPos); |
|
|
|
const float3 worldCamPos = WorldScale(_CameraPosWS.xyz); |
|
|
|
const float3 worldCamPos = WorldScale(_WorldSpaceCameraPos.xyz); |
|
|
|
|
|
|
|
const float c_MieScaleHeight = 1200.f; |
|
|
|
const float worldRayleighDensity = 1.f; |
|
|
|
|
|
|
const float worldVecLen = length(worldVec); |
|
|
|
const float3 worldDir = worldVec / worldVecLen; |
|
|
|
|
|
|
|
const float3 worldDirUnscaled = normalize(worldPos - _CameraPosWS.xyz); |
|
|
|
const float3 worldDirUnscaled = normalize(worldPos - _WorldSpaceCameraPos.xyz); |
|
|
|
|
|
|
|
const float viewSunCos = dot(worldDirUnscaled, _SunDirection); |
|
|
|
const float rayleighPh = min(1.f, RayleighPhase(viewSunCos) * 12.f); |
|
|
|