|
|
|
|
|
|
RTHandleSystem.RTHandle m_DistortionBuffer; |
|
|
|
|
|
|
|
// The pass "SRPDefaultUnlit" is a fall back to legacy unlit rendering and is required to support unity 2d + unity UI that render in the scene.
|
|
|
|
ShaderPassName[] m_ForwardAndForwardOnlyPassNames = { new ShaderPassName(), new ShaderPassName(), HDShaderPassNames.s_SRPDefaultUnlitName }; |
|
|
|
ShaderPassName[] m_ForwardOnlyPassNames = { new ShaderPassName(), HDShaderPassNames.s_SRPDefaultUnlitName }; |
|
|
|
ShaderPassName[] m_ForwardAndForwardOnlyPassNames = { HDShaderPassNames.s_ForwardOnlyName, HDShaderPassNames.s_ForwardName, HDShaderPassNames.s_SRPDefaultUnlitName }; |
|
|
|
ShaderPassName[] m_ForwardOnlyPassNames = { HDShaderPassNames.s_ForwardOnlyName, HDShaderPassNames.s_SRPDefaultUnlitName }; |
|
|
|
|
|
|
|
ShaderPassName[] m_AllTransparentPassNames = { HDShaderPassNames.s_TransparentBackfaceName, |
|
|
|
HDShaderPassNames.s_ForwardOnlyName, |
|
|
|
|
|
|
StartStereoRendering(renderContext, hdCamera); |
|
|
|
|
|
|
|
RenderForward(m_CullResults, hdCamera, renderContext, cmd, ForwardPass.Opaque); |
|
|
|
RenderForwardError(m_CullResults, hdCamera, renderContext, cmd, ForwardPass.Opaque); |
|
|
|
|
|
|
|
// SSS pass here handle both SSS material from deferred and forward
|
|
|
|
m_SSSBufferManager.SubsurfaceScatteringPass(hdCamera, cmd, diffusionProfileSettings, |
|
|
|
|
|
|
|
|
|
|
// Render pre refraction objects
|
|
|
|
RenderForward(m_CullResults, hdCamera, renderContext, cmd, ForwardPass.PreRefraction); |
|
|
|
RenderForwardError(m_CullResults, hdCamera, renderContext, cmd, ForwardPass.PreRefraction); |
|
|
|
RenderForwardError(m_CullResults, hdCamera, renderContext, cmd, ForwardPass.Transparent); |
|
|
|
|
|
|
|
// Render All forward error
|
|
|
|
RenderForwardError(m_CullResults, hdCamera, renderContext, cmd); |
|
|
|
|
|
|
|
// Fill depth buffer to reduce artifact for transparent object during postprocess
|
|
|
|
RenderTransparentDepthPostpass(m_CullResults, hdCamera, renderContext, cmd, ForwardPass.Transparent); |
|
|
|
|
|
|
HDUtils.SetRenderTarget(cmd, hdCamera, m_CameraColorBuffer, m_CameraDepthStencilBuffer); |
|
|
|
} |
|
|
|
|
|
|
|
m_ForwardAndForwardOnlyPassNames[0] = m_ForwardOnlyPassNames[0] = |
|
|
|
HDShaderPassNames.s_ForwardOnlyName; |
|
|
|
m_ForwardAndForwardOnlyPassNames[1] = HDShaderPassNames.s_ForwardName; |
|
|
|
|
|
|
|
var passNames = hdCamera.frameSettings.enableForwardRenderingOnly |
|
|
|
? m_ForwardAndForwardOnlyPassNames |
|
|
|
: m_ForwardOnlyPassNames; |
|
|
|
|
|
|
|
|
|
|
// This is use to Display legacy shader with an error shader
|
|
|
|
[Conditional("DEVELOPMENT_BUILD"), Conditional("UNITY_EDITOR")] |
|
|
|
void RenderForwardError(CullResults cullResults, HDCamera hdCamera, ScriptableRenderContext renderContext, CommandBuffer cmd, ForwardPass pass) |
|
|
|
void RenderForwardError(CullResults cullResults, HDCamera hdCamera, ScriptableRenderContext renderContext, CommandBuffer cmd) |
|
|
|
|
|
|
|
if (pass == ForwardPass.Opaque) |
|
|
|
{ |
|
|
|
RenderOpaqueRenderList(cullResults, hdCamera, renderContext, cmd, m_ForwardErrorPassNames, 0, null, null, m_ErrorMaterial); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
RenderTransparentRenderList(cullResults, hdCamera, renderContext, cmd, m_ForwardErrorPassNames, 0, pass == ForwardPass.PreRefraction ? HDRenderQueue.k_RenderQueue_PreRefraction : HDRenderQueue.k_RenderQueue_Transparent, null, m_ErrorMaterial); |
|
|
|
} |
|
|
|
RenderOpaqueRenderList(cullResults, hdCamera, renderContext, cmd, m_ForwardErrorPassNames, 0, RenderQueueRange.all, null, m_ErrorMaterial); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|