|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Clear GBuffers
|
|
|
|
using (new Utilities.ProfilingSample("Clear GBuffer", renderContext)) |
|
|
|
if (!debugParameters.ShouldUseForwardRenderingOnly()) |
|
|
|
Utilities.SetRenderTarget(renderContext, m_gbufferManager.GetGBuffers(), m_CameraDepthBufferRT, ClearFlag.ClearColor, Color.black); |
|
|
|
using (new Utilities.ProfilingSample("Clear GBuffer", renderContext)) |
|
|
|
{ |
|
|
|
Utilities.SetRenderTarget(renderContext, m_gbufferManager.GetGBuffers(), m_CameraDepthBufferRT, ClearFlag.ClearColor, Color.black); |
|
|
|
} |
|
|
|
|
|
|
|
// END TEMP
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
Shader.SetGlobalInt("_DebugViewMaterial", (int)debugParameters.debugViewMaterial); |
|
|
|
|
|
|
|
RenderOpaqueRenderList(cull, hdCamera.camera, renderContext, "DebugViewMaterial"); |
|
|
|
RenderOpaqueRenderList(cull, hdCamera.camera, renderContext, "DebugViewMaterial", Utilities.kRendererConfigurationBakedLighting); |
|
|
|
} |
|
|
|
|
|
|
|
// Render GBuffer opaque
|
|
|
|
|
|
|
|
|
|
|
// Render forward transparent
|
|
|
|
{ |
|
|
|
RenderTransparentRenderList(cull, hdCamera.camera, renderContext, "DebugViewMaterial"); |
|
|
|
RenderTransparentRenderList(cull, hdCamera.camera, renderContext, "DebugViewMaterial", Utilities.kRendererConfigurationBakedLighting); |
|
|
|
} |
|
|
|
|
|
|
|
// Last blit
|
|
|
|
|
|
|
return ; |
|
|
|
} |
|
|
|
|
|
|
|
// Bind material data
|
|
|
|
m_LitRenderLoop.Bind(); |
|
|
|
m_lightLoop.RenderDeferredLighting(hdCamera, renderContext, m_CameraColorBuffer); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
using (new Utilities.ProfilingSample("Forward Pass", renderContext)) |
|
|
|
{ |
|
|
|
// Bind material data
|
|
|
|
m_LitRenderLoop.Bind(); |
|
|
|
|
|
|
|
Utilities.SetRenderTarget(renderContext, m_CameraColorBufferRT, m_CameraDepthBufferRT); |
|
|
|
|
|
|
|
m_lightLoop.RenderForward(camera, renderContext, renderOpaque); |
|
|
|
|
|
|
RenderOpaqueRenderList(cullResults, camera, renderContext, "Forward"); |
|
|
|
RenderOpaqueRenderList(cullResults, camera, renderContext, "Forward", Utilities.kRendererConfigurationBakedLighting); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
|
|
|
{ |
|
|
|
using (new Utilities.ProfilingSample("Forward Only Pass", renderContext)) |
|
|
|
{ |
|
|
|
// Bind material data
|
|
|
|
m_LitRenderLoop.Bind(); |
|
|
|
|
|
|
|
RenderOpaqueRenderList(cullResults, camera, renderContext, "ForwardOnlyOpaque"); |
|
|
|
RenderOpaqueRenderList(cullResults, camera, renderContext, "ForwardOnlyOpaque", Utilities.kRendererConfigurationBakedLighting); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
InitAndClearBuffer(camera, renderContext); |
|
|
|
|
|
|
|
// TODO: Find a correct place to bind these material textures
|
|
|
|
// We have to bind the material specific global parameters in this mode
|
|
|
|
m_LitRenderLoop.Bind(); |
|
|
|
|
|
|
|
RenderDepthPrepass(cullResults, camera, renderContext); |
|
|
|
|
|
|
|
// Forward opaque with deferred/cluster tile require that we fill the depth buffer
|
|
|
|
|
|
|
using (new Utilities.ProfilingSample("Build Light list", renderContext)) |
|
|
|
{ |
|
|
|
m_lightLoop.PrepareLightsForGPU(m_ShadowSettings, cullResults, camera, ref shadows); |
|
|
|
m_lightLoop.BuildGPULightLists(camera, renderContext, m_CameraDepthBufferRT); // TODO: Use async compute here to run light culling during shadow
|
|
|
|
|
|
|
|
PushGlobalParams(hdCamera, renderContext); |
|
|
|
m_lightLoop.BuildGPULightLists(camera, renderContext, m_CameraDepthBufferRT); // TODO: Use async compute here to run light culling during shadow
|
|
|
|
|
|
|
|
PushGlobalParams(hdCamera, renderContext); |
|
|
|
|
|
|
|
// Caution: We require sun light here as some sky use the sun light to render, mean UpdateSkyEnvironment
|
|
|
|
// must be call after BuildGPULightLists.
|
|
|
|