|
|
|
|
|
|
private FinalBlitPass m_FinalBlitPass; |
|
|
|
private EndXRRenderingPass m_EndXrRenderingPass; |
|
|
|
|
|
|
|
#if UNITY_EDITOR
|
|
|
|
private SceneViewDepthCopyPass m_SceneViewDepthCopyPass; |
|
|
|
#endif
|
|
|
|
|
|
|
|
public RenderTargetHandle Color; |
|
|
|
public RenderTargetHandle DepthAttachment; |
|
|
|
public RenderTargetHandle DepthTexture; |
|
|
|
public RenderTargetHandle OpaqueColor; |
|
|
|
public RenderTargetHandle DirectionalShadowmap; |
|
|
|
public RenderTargetHandle LocalShadowmap; |
|
|
|
public RenderTargetHandle ScreenSpaceShadowmap; |
|
|
|
|
|
|
|
[NonSerialized] |
|
|
|
private bool m_Initialized = false; |
|
|
|
|
|
|
m_TransparentPostProcessPass = new TransparentPostProcessPass(renderer); |
|
|
|
m_FinalBlitPass = new FinalBlitPass(renderer); |
|
|
|
m_EndXrRenderingPass = new EndXRRenderingPass(renderer); |
|
|
|
m_WaterFXPass = new WaterFXPass(renderer); |
|
|
|
m_WaterFXPass = new WaterFXPass(renderer); |
|
|
|
#if UNITY_EDITOR
|
|
|
|
m_SceneViewDepthCopyPass = new SceneViewDepthCopyPass(renderer); |
|
|
|
#endif
|
|
|
|
|
|
|
|
// RenderTexture format depends on camera and pipeline (HDR, non HDR, etc)
|
|
|
|
// Samples (MSAA) depend on camera and pipeline
|
|
|
|
renderer.RegisterSurface("_CameraColorTexture", out Color); |
|
|
|
renderer.RegisterSurface("_CameraDepthAttachment", out DepthAttachment); |
|
|
|
renderer.RegisterSurface("_CameraDepthTexture", out DepthTexture); |
|
|
|
renderer.RegisterSurface("_CameraOpaqueTexture", out OpaqueColor); |
|
|
|
renderer.RegisterSurface("_DirectionalShadowmapTexture", out DirectionalShadowmap); |
|
|
|
renderer.RegisterSurface("_LocalShadowmapTexture", out LocalShadowmap); |
|
|
|
renderer.RegisterSurface("_ScreenSpaceShadowMapTexture", out ScreenSpaceShadowmap); |
|
|
|
|
|
|
|
m_Initialized = true; |
|
|
|
} |
|
|
|
|
|
|
requiresDepthPrepass |= renderingData.cameraData.isStereoEnabled; |
|
|
|
|
|
|
|
if (renderingData.shadowData.renderDirectionalShadows) |
|
|
|
{ |
|
|
|
m_DirectionalShadowPass.Setup(DirectionalShadowmap); |
|
|
|
} |
|
|
|
{ |
|
|
|
|
|
|
|
m_LocalShadowPass.Setup(LocalShadowmap); |
|
|
|
} |
|
|
|
m_DepthOnlyPass.Setup(baseDescriptor, RenderTargetHandles.DepthTexture, SampleCount.One); |
|
|
|
m_DepthOnlyPass.Setup(baseDescriptor, DepthTexture, SampleCount.One); |
|
|
|
renderer.EnqueuePass(m_DepthOnlyPass); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
m_ScreenSpaceShadowResovePass.Setup(baseDescriptor, RenderTargetHandles.ScreenSpaceShadowmap); |
|
|
|
m_ScreenSpaceShadowResovePass.Setup(baseDescriptor, ScreenSpaceShadowmap); |
|
|
|
renderer.EnqueuePass(m_ScreenSpaceShadowResovePass); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
ref renderingData.cameraData, |
|
|
|
baseDescriptor, |
|
|
|
requiresDepthAttachment); |
|
|
|
RenderTargetHandle colorHandle = (requiresColorAttachment) ? RenderTargetHandles.Color : RenderTargetHandle.BackBuffer; |
|
|
|
RenderTargetHandle depthHandle = (requiresDepthAttachment) ? RenderTargetHandles.DepthAttachment : RenderTargetHandle.BackBuffer; |
|
|
|
RenderTargetHandle colorHandle = (requiresColorAttachment) ? Color : RenderTargetHandle.BackBuffer; |
|
|
|
RenderTargetHandle depthHandle = (requiresDepthAttachment) ? DepthAttachment : RenderTargetHandle.BackBuffer; |
|
|
|
|
|
|
|
var sampleCount = (SampleCount)renderingData.cameraData.msaaSamples; |
|
|
|
m_CreateLightweightRenderTexturesPass.Setup(baseDescriptor, colorHandle, depthHandle, sampleCount); |
|
|
|
|
|
|
renderer.EnqueuePass(m_BeginXrRenderingPass); |
|
|
|
|
|
|
|
renderer.EnqueuePass(m_WaterFXPass); |
|
|
|
|
|
|
|
Camera camera = renderingData.cameraData.camera; |
|
|
|
bool dynamicBatching = renderingData.supportsDynamicBatching; |
|
|
|
|
|
|
|
|
|
|
//renderer.EnqueuePass(m_WaterFXPass);
|
|
|
|
|
|
|
|
m_RenderOpaqueForwardPass.Setup(baseDescriptor, colorHandle, depthHandle, LightweightForwardRenderer.GetCameraClearFlag(camera), camera.backgroundColor, rendererConfiguration, dynamicBatching); |
|
|
|
renderer.EnqueuePass(m_RenderOpaqueForwardPass); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (depthHandle != RenderTargetHandle.BackBuffer) |
|
|
|
{ |
|
|
|
m_CopyDepthPass.Setup(depthHandle); |
|
|
|
m_CopyDepthPass.Setup(depthHandle, DepthTexture); |
|
|
|
m_CopyColorPass.Setup(colorHandle); |
|
|
|
m_CopyColorPass.Setup(colorHandle, OpaqueColor); |
|
|
|
renderer.EnqueuePass(m_CopyColorPass); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
{ |
|
|
|
renderer.EnqueuePass(m_EndXrRenderingPass); |
|
|
|
} |
|
|
|
|
|
|
|
#if UNITY_EDITOR
|
|
|
|
if (renderingData.cameraData.isSceneViewCamera) |
|
|
|
{ |
|
|
|
m_SceneViewDepthCopyPass.Setup(DepthTexture); |
|
|
|
renderer.EnqueuePass(m_SceneViewDepthCopyPass); |
|
|
|
} |
|
|
|
#endif
|
|
|
|
} |
|
|
|
} |
|
|
|
} |