浏览代码

Various fixes

/main
Frédéric Vauchelles 6 年前
当前提交
41dc00b0
共有 5 个文件被更改,包括 29 次插入36 次删除
  1. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Debug/DebugFullScreen.shader
  2. 41
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/HDRenderPipeline.cs
  3. 4
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/Reflection/ScreenSpaceTracing.hlsl
  4. 6
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Lit/Lit.cs.hlsl
  5. 12
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Lit/Lit.hlsl

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Debug/DebugFullScreen.shader


float cellSDF = 0;
float debugLinearDepth = 0;
if (debug.tracingModel == PROJECTION_MODEL_HI_Z)
if (debug.tracingModel == PROJECTIONMODEL_HI_Z)
{
const uint2 iterationCellSize = uint2(debug.iterationCellSizeW, debug.iterationCellSizeH);
const float hasData = iterationCellSize.x != 0 || iterationCellSize.y != 0;

41
ScriptableRenderPipeline/HDRenderPipeline/HDRP/HDRenderPipeline.cs


m_LightLoop.RenderForward(camera, cmd, pass == ForwardPass.Opaque);
var debugScreenSpaceTracing = m_CurrentDebugDisplaySettings.fullScreenDebugMode == FullScreenDebugMode.ScreenSpaceTracing;
switch (pass)
{
case ForwardPass.Opaque:
if (pass == ForwardPass.Opaque)
{
// In case of forward SSS we will bind all the required target. It is up to the shader to write into it or not.
if (m_FrameSettings.enableSubsurfaceScattering)

var passNames = m_FrameSettings.enableForwardRenderingOnly
? m_ForwardAndForwardOnlyPassNames
: m_ForwardOnlyPassNames;
var debugSSTThisPass = debugScreenSpaceTracing && (m_CurrentDebugDisplaySettings.lightingDebugSettings.debugLightingMode == DebugLightingMode.ScreenSpaceTracingReflection);
if (debugSSTThisPass)
{
cmd.SetGlobalBuffer(HDShaderIDs._DebugScreenSpaceTracingData, m_DebugScreenSpaceTracingData);
cmd.SetRandomWriteTarget(7, m_DebugScreenSpaceTracingData);
}
var debugSSTThisPass = debugScreenSpaceTracing && (m_CurrentDebugDisplaySettings.lightingDebugSettings.debugLightingMode == DebugLightingMode.ScreenSpaceTracingReflection);
if (debugSSTThisPass)
{
cmd.SetGlobalBuffer(HDShaderIDs._DebugScreenSpaceTracingData, m_DebugScreenSpaceTracingData);
cmd.SetRandomWriteTarget(7, m_DebugScreenSpaceTracingData);
}
if (debugSSTThisPass)
cmd.ClearRandomWriteTargets();
break;
if (debugSSTThisPass)
cmd.ClearRandomWriteTargets();
default:
else
HDUtils.SetRenderTarget(cmd, hdCamera, m_CameraColorBuffer, m_CameraDepthStencilBuffer);
if (m_FrameSettings.enableDBuffer && (DecalSystem.m_DecalsVisibleThisFrame > 0)) // enable d-buffer flag value is being interpreted more like enable decals in general now that we have clustered
DecalSystem.instance.SetAtlas(cmd); // for clustered decals
var debugSSTThisPass = debugScreenSpaceTracing && (m_CurrentDebugDisplaySettings.lightingDebugSettings.debugLightingMode == DebugLightingMode.ScreenSpaceTracingRefraction);
if (debugSSTThisPass)
HDUtils.SetRenderTarget(cmd, hdCamera, m_CameraColorBuffer, m_CameraDepthStencilBuffer);
if ((m_FrameSettings.enableDBuffer) && (DecalSystem.m_DecalsVisibleThisFrame > 0)) // enable d-buffer flag value is being interpreted more like enable decals in general now that we have clustered
{
DecalSystem.instance.SetAtlas(cmd); // for clustered decals
}
var debugSSTThisPass = debugScreenSpaceTracing && (m_CurrentDebugDisplaySettings.lightingDebugSettings.debugLightingMode == DebugLightingMode.ScreenSpaceTracingRefraction);

cmd.SetRandomWriteTarget(7, m_DebugScreenSpaceTracingData);
cmd.SetRandomWriteTarget(7, m_DebugScreenSpaceTracingData);
if (debugSSTThisPass)
if (debugSSTThisPass)
break;
}
}
// This is use to Display legacy shader with an error shader
[Conditional("DEVELOPMENT_BUILD"), Conditional("UNITY_EDITOR")]

4
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/Reflection/ScreenSpaceTracing.hlsl


float2 rayOriginNDC = ComputeNormalizedDeviceCoordinates(input.rayOriginWS, GetWorldToHClipMatrix());
uint2 rayOriginSS = uint2(rayOriginNDC * _ScreenSize.xy);
debug.tracingModel = PROJECTION_MODEL_PROXY;
debug.tracingModel = PROJECTIONMODEL_PROXY;
debug.loopStartPositionSSX = rayOriginSS.x;
debug.loopStartPositionSSY = rayOriginSS.y;
debug.loopStartLinearDepth = rayOriginCS.w;

ScreenSpaceTracingDebug debug;
ZERO_INITIALIZE(ScreenSpaceTracingDebug, debug);
debug.tracingModel = PROJECTION_MODEL_HI_Z;
debug.tracingModel = PROJECTIONMODEL_HI_Z;
debug.loopStartPositionSSX = uint(startPositionSS.x);
debug.loopStartPositionSSY = uint(startPositionSS.y);
debug.loopStartLinearDepth = 1 / startPositionSS.z;

6
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Lit/Lit.cs.hlsl


//
// UnityEngine.Experimental.Rendering.HDPipeline.Lit+ProjectionModel: static fields
//
#define PROJECTION_MODEL_NONE (0)
#define PROJECTION_MODEL_PROXY (1)
#define PROJECTION_MODEL_HI_Z (2)
#define PROJECTIONMODEL_NONE (0)
#define PROJECTIONMODEL_PROXY (1)
#define PROJECTIONMODEL_HI_Z (2)
//
// UnityEngine.Experimental.Rendering.HDPipeline.Lit+HiZIntersectionKind: static fields

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


// -------------------------------
// Choose projection model
// -------------------------------
int projectionModel = PROJECTION_MODEL_NONE;
int projectionModel = PROJECTIONMODEL_NONE;
projectionModel = PROJECTION_MODEL_HI_Z;
projectionModel = PROJECTIONMODEL_HI_Z;
projectionModel = PROJECTION_MODEL_PROXY;
projectionModel = PROJECTIONMODEL_PROXY;
#endif
}
#else

if (projectionModel == PROJECTION_MODEL_NONE)
if (projectionModel == PROJECTIONMODEL_NONE)
return lighting;
// -------------------------------

// -------------------------------
// Proxy raycasting
// -------------------------------
if (projectionModel == PROJECTION_MODEL_PROXY)
if (projectionModel == PROJECTIONMODEL_PROXY)
{
ScreenSpaceProxyRaycastInput ssRayInput;
ZERO_INITIALIZE(ScreenSpaceProxyRaycastInput, ssRayInput);

// -------------------------------
// HiZ raymarching
// -------------------------------
else if (projectionModel == PROJECTION_MODEL_HI_Z)
else if (projectionModel == PROJECTIONMODEL_HI_Z)
{
ScreenSpaceHiZRaymarchInput ssRayInput;
ZERO_INITIALIZE(ScreenSpaceHiZRaymarchInput, ssRayInput);

正在加载...
取消
保存