|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void WriteResult(uint2 pixelCoord, float3 irradiance) |
|
|
|
void StoreResult(uint2 pixelCoord, float3 irradiance) |
|
|
|
{ |
|
|
|
#ifdef USE_INTERMEDIATE_BUFFER |
|
|
|
_CameraFilteringTexture[pixelCoord] = float4(irradiance, 1); |
|
|
|
|
|
|
[branch] if (distScale == 0 || maxDistInPixels < 1) |
|
|
|
{ |
|
|
|
#if SSS_DEBUG_LOD |
|
|
|
WriteResult(pixelCoord, float3(0, 0, 1)); |
|
|
|
StoreResult(pixelCoord, float3(0, 0, 1)); |
|
|
|
WriteResult(pixelCoord, albedo * centerIrradiance); |
|
|
|
StoreResult(pixelCoord, albedo * centerIrradiance); |
|
|
|
#endif |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
float3 viewDirVS = normalize(centerPosVS); |
|
|
|
if (dot(normalVS, viewDirVS) >= 0) |
|
|
|
{ |
|
|
|
WriteResult(pixelCoord, float3(1, 1, 1)); |
|
|
|
StoreResult(pixelCoord, float3(1, 1, 1)); |
|
|
|
return; |
|
|
|
} |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
#if SSS_DEBUG_LOD |
|
|
|
WriteResult(pixelCoord, useNearFieldKernel ? float3(1, 0, 0) : float3(0.5, 0.5, 0); |
|
|
|
StoreResult(pixelCoord, useNearFieldKernel ? float3(1, 0, 0) : float3(0.5, 0.5, 0); |
|
|
|
return; |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[branch] if (!useNearFieldKernel) |
|
|
|
{ |
|
|
|
WriteResult(pixelCoord, albedo * totalIrradiance / totalWeight); |
|
|
|
StoreResult(pixelCoord, albedo * totalIrradiance / totalWeight); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
totalIrradiance, totalWeight); |
|
|
|
} |
|
|
|
|
|
|
|
WriteResult(pixelCoord, albedo * totalIrradiance / totalWeight); |
|
|
|
StoreResult(pixelCoord, albedo * totalIrradiance / totalWeight); |
|
|
|
} |