浏览代码

Added int to switch between raymarching algorithm for testing purpose

/feature-ScreenSpaceProjection
Frédéric Vauchelles 7 年前
当前提交
070dec58
共有 6 个文件被更改,包括 46 次插入21 次删除
  1. 1
      ScriptableRenderPipeline/Core/CoreRP/ShaderLibrary/ScreenSpaceRaymarching.hlsl
  2. 9
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Debug/DebugDisplay.cs
  3. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Debug/LightingDebug.cs
  4. 1
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/HDRenderPipeline.cs
  5. 1
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/HDStringConstants.cs
  6. 53
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Lit/Lit.hlsl

1
ScriptableRenderPipeline/Core/CoreRP/ShaderLibrary/ScreenSpaceRaymarching.hlsl


CBUFFER_START(ScreenSpaceRaymarching)
int _SSRayMinLevel;
int _SSRayMaxLevel;
int _SSRayAlgorithm;
CBUFFER_END
struct ScreenSpaceHiZRaymarchInput

9
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Debug/DebugDisplay.cs


list.Add(
new DebugUI.FloatField
{
displayName = "SST Crossing Offset",
getter = () => lightingDebugSettings.sstCrossingOffset,
setter = value => lightingDebugSettings.sstCrossingOffset = value,
});
displayName = "SSRayAlgorithm",
getter = () => lightingDebugSettings.ssRayAlgorithm,
setter = value => lightingDebugSettings.ssRayAlgorithm = value,
}
);
list.Add(new DebugUI.EnumField { displayName = "Fullscreen Debug Mode", getter = () => (int)fullScreenDebugMode, setter = value => fullScreenDebugMode = (FullScreenDebugMode)value, enumNames = lightingFullScreenDebugStrings, enumValues = lightingFullScreenDebugValues, onValueChanged = RefreshLightingDebug });
switch (fullScreenDebugMode)

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Debug/LightingDebug.cs


}
public DebugScreenSpaceTracing debugScreenSpaceTracingMode = DebugScreenSpaceTracing.None;
public float sstCrossingOffset;
public float ssRayAlgorithm;
public DebugLightingMode debugLightingMode = DebugLightingMode.None;
public ShadowMapDebugMode shadowDebugMode = ShadowMapDebugMode.None;
public bool shadowDebugUseSelection = false;

1
ScriptableRenderPipeline/HDRenderPipeline/HDRP/HDRenderPipeline.cs


public void ApplyDebugDisplaySettings(HDCamera hdCamera, CommandBuffer cmd)
{
cmd.SetGlobalInt(HDShaderIDs._SSRayAlgorithm, (int)m_CurrentDebugDisplaySettings.lightingDebugSettings.ssRayAlgorithm);
if (m_CurrentDebugDisplaySettings.IsDebugDisplayEnabled() ||
m_CurrentDebugDisplaySettings.fullScreenDebugMode != FullScreenDebugMode.None ||
m_CurrentDebugDisplaySettings.colorPickerDebugSettings.colorPickerMode != ColorPickerDebugMode.None)

1
ScriptableRenderPipeline/HDRenderPipeline/HDRP/HDStringConstants.cs


public static readonly int _SSRayMinLevel = Shader.PropertyToID("_SSRayMinLevel");
public static readonly int _SSRayMaxLevel = Shader.PropertyToID("_SSRayMaxLevel");
public static readonly int _SSRayAlgorithm = Shader.PropertyToID("_SSRayAlgorithm");
}
}

53
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Lit/Lit.hlsl


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)

正在加载...
取消
保存