|
|
|
|
|
|
|
|
|
|
uint2 depthSize = uint2(_PyramidDepthMipSize.xy); |
|
|
|
|
|
|
|
ScreenSpaceLinearRaymarchInput ssInput; |
|
|
|
ZERO_INITIALIZE(ScreenSpaceLinearRaymarchInput, ssInput); |
|
|
|
ScreenSpaceRayHit hit; |
|
|
|
ZERO_INITIALIZE(ScreenSpaceRayHit, hit); |
|
|
|
//ScreenSpaceHiZRaymarchInput ssInput; |
|
|
|
//ZERO_INITIALIZE(ScreenSpaceHiZRaymarchInput, ssInput); |
|
|
|
bool hitSuccessful = false; |
|
|
|
switch (_SSRayAlgorithm) |
|
|
|
{ |
|
|
|
case 0: |
|
|
|
{ |
|
|
|
ScreenSpaceHiZRaymarchInput ssInput; |
|
|
|
ZERO_INITIALIZE(ScreenSpaceHiZRaymarchInput, ssInput); |
|
|
|
ssInput.startPositionVS = positionVS; |
|
|
|
ssInput.startLinearDepth = posInput.linearDepth; |
|
|
|
ssInput.dirVS = transparentRefractVVS; |
|
|
|
ssInput.projectionMatrix = UNITY_MATRIX_P; |
|
|
|
ssInput.bufferSize = depthSize; |
|
|
|
ssInput.minLevel = 0; |
|
|
|
ssInput.maxLevel = int(_PyramidDepthMipSize.z); |
|
|
|
#ifdef DEBUG_DISPLAY |
|
|
|
ssInput.writeStepDebug = !any(int2(_MouseClickPixelCoord.xy) - int2(posInput.positionSS)); |
|
|
|
#endif |
|
|
|
ScreenSpaceRayHit hit; |
|
|
|
ZERO_INITIALIZE(ScreenSpaceRayHit, hit); |
|
|
|
|
|
|
|
ssInput.startPositionVS = positionVS; |
|
|
|
ssInput.startLinearDepth = posInput.linearDepth; |
|
|
|
ssInput.dirVS = transparentRefractVVS; |
|
|
|
ssInput.projectionMatrix = UNITY_MATRIX_P; |
|
|
|
ssInput.bufferSize = depthSize; |
|
|
|
//ssInput.minLevel = 0; |
|
|
|
//ssInput.maxLevel = int(_PyramidDepthMipSize.z); |
|
|
|
hitSuccessful = ScreenSpaceHiZRaymarch(ssInput, hit); |
|
|
|
break; |
|
|
|
} |
|
|
|
case 1: |
|
|
|
{ |
|
|
|
ScreenSpaceLinearRaymarchInput ssInput; |
|
|
|
ZERO_INITIALIZE(ScreenSpaceLinearRaymarchInput, ssInput); |
|
|
|
ssInput.startPositionVS = positionVS; |
|
|
|
ssInput.startLinearDepth = posInput.linearDepth; |
|
|
|
ssInput.dirVS = transparentRefractVVS; |
|
|
|
ssInput.projectionMatrix = UNITY_MATRIX_P; |
|
|
|
ssInput.bufferSize = depthSize; |
|
|
|
ssInput.writeStepDebug = !any(int2(_MouseClickPixelCoord.xy) - int2(posInput.positionSS)); |
|
|
|
ssInput.writeStepDebug = !any(int2(_MouseClickPixelCoord.xy) - int2(posInput.positionSS)); |
|
|
|
bool hitSuccessful = ScreenSpaceLinearRaymarch(ssInput, hit); |
|
|
|
hitSuccessful = ScreenSpaceLinearRaymarch(ssInput, hit); |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
#ifdef DEBUG_DISPLAY |
|
|
|
if (_DebugLightingMode == DEBUGLIGHTINGMODE_SCREEN_SPACE_TRACING_REFRACTION) |
|
|
|