|
|
|
|
|
|
|
|
|
|
#pragma enable_d3d11_debug_symbols |
|
|
|
|
|
|
|
#define DEBUG_REPROJECTION 0 |
|
|
|
#define ENABLE_REPROJECTION 0 |
|
|
|
#define DEBUG_REPROJECTION 0 |
|
|
|
|
|
|
|
#include "../../../ShaderPass/ShaderPass.cs.hlsl" |
|
|
|
#define SHADERPASS SHADERPASS_VOLUMETRIC_LIGHTING |
|
|
|
|
|
|
); |
|
|
|
#endif |
|
|
|
|
|
|
|
#if ENABLE_REPROJECTION |
|
|
|
// Reproject the history at 'centerWS'. |
|
|
|
// TODO! WARNING! THE REPROJECTED VALUE IS AN INTEGRAL OVER A SEGMENT, THE LENGTH OF THE CURRENT SEGMENT IS DIFFERENT, ACCOUNT FOR THAT! |
|
|
|
float2 reprojPosNDC = ComputeNormalizedDeviceCoordinates(centerWS, _PrevViewProjMatrix); |
|
|
|
|
|
|
|
|
|
|
// Store the feedback. |
|
|
|
_VBufferLightingFeedback[uint3(posInput.positionSS, slice)] = float4(blendedRadiance, 1); |
|
|
|
#else |
|
|
|
float3 blendedRadiance = voxelRadiance; |
|
|
|
#endif |
|
|
|
#if (DEBUG_REPROJECTION != 0) |
|
|
|
#if DEBUG_REPROJECTION |
|
|
|
if (distance(voxelRadiance, reprojValue.rgb) > 0.1) blendedRadiance = float3(1000, 0, 0); |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
#if ENABLE_REPROJECTION |
|
|
|
|
|
|
|
|
|
|
|
// float2 sampleCoord = voxelCoord + 0.5; |
|
|
|
#else |
|
|
|
float2 sampleCoord = voxelCoord + 0.5; |
|
|
|
#endif |
|
|
|
|
|
|
|
// Compute the ray direction s.t. its ViewSpaceZ = 1. |
|
|
|
float3 dir = -mul(float3(sampleCoord, 1), (float3x3)_VBufferCoordToViewDirWS); |
|
|
|