readonly int m_VelocityBuffer ;
readonly int m_DistortionBuffer ;
readonly int m_DeferredShadowBuffer ;
// 'm_CameraColorBuffer' does not contain diffuse lighting of SSS materials until the SSS pass. It is stored within 'm_CameraSssDiffuseLightingBuffer'.
readonly RenderTargetIdentifier m_CameraColorBufferRT ;
readonly RenderTargetIdentifier m_CameraSssDiffuseLightingBufferRT ;
readonly RenderTargetIdentifier m_VelocityBufferRT ;
readonly RenderTargetIdentifier m_DistortionBufferRT ;
readonly RenderTargetIdentifier m_DeferredShadowBufferRT ;
private RenderTexture m_DeferredDirShadow = null ;
private RenderTargetIdentifier m_DeferredDirShadowRT ;
// Post-processing context and screen-space effects (recycled on every frame to avoid GC alloc)
readonly PostProcessRenderContext m_PostProcessContext ;
m_DistortionBuffer = HDShaderIDs . _DistortionTexture ;
m_DistortionBufferRT = new RenderTargetIdentifier ( m_DistortionBuffer ) ;
m_DeferredShadowBuffer = HDShaderIDs . _DeferredShadowTexture ;
m_DeferredShadowBufferRT = new RenderTargetIdentifier ( m_DeferredShadowBuffer ) ;
m_MaterialList . ForEach ( material = > material . Build ( asset . renderPipelineResources ) ) ;
m_LightLoop . Build ( asset . renderPipelineResources , asset . tileSettings , asset . textureSettings , asset . shadowInitParams , m_ShadowSettings ) ;
m_HTileRT = new RenderTargetIdentifier ( m_HTile ) ;
}
m_DeferredDirShadow = new RenderTexture ( camera . pixelWidth , camera . pixelHeight , 0 , RenderTextureFormat . ARGB32 , RenderTextureReadWrite . Linear ) ;
m_DeferredDirShadow . filterMode = FilterMode . Point ;
m_DeferredDirShadow . enableRandomWrite = true ;
m_DeferredDirShadow . Create ( ) ;
m_DeferredDirShadowRT = new RenderTargetIdentifier ( m_DeferredDirShadow ) ;
}
void Resize ( Camera camera )
// TODO: Everything here (SSAO, Shadow, Build light list, material and light classification can be parallelize with Async compute)
m_SsaoEffect . Render ( ssaoSettingsToUse , this , hdCamera , renderContext , cmd , m_Asset . renderingSettings . useForwardRenderingOnly ) ;
m_LightLoop . PrepareLightsForGPU ( m_ShadowSettings , m_CullResults , camera ) ;
m_LightLoop . RenderShadows ( renderContext , cmd , m_CullResults ) ;
m_LightLoop . RenderShadows ( renderContext , cmd , m_CullResults ) ;
m_LightLoop . RenderDeferredDirectionalShadow ( hdCamera , m_DeferredDirShadowRT , GetDepthTexture ( ) , cmd ) ;
cmd . GetTemporaryRT ( m_DeferredShadowBuffer , camera . pixelWidth , camera . pixelHeight , 0 , FilterMode . Point , RenderTextureFormat . ARGB32 , RenderTextureReadWrite . Linear , 1 , true ) ;
m_LightLoop . RenderDeferredDirectionalShadow ( hdCamera , m_DeferredShadowBufferRT , GetDepthTexture ( ) , cmd ) ;
PushFullScreenDebugTexture ( cmd , m_DeferredDirShadowRT , hdCamera . camera , renderContext , FullScreenDebugMode . DeferredShadows ) ;
PushFullScreenDebugTexture ( cmd , m_DeferredShadowBuffer , hdCamera . camera , renderContext , FullScreenDebugMode . DeferredShadows ) ;
renderContext . SetupCameraProperties ( camera ) ; // Need to recall SetupCameraProperties after m_ShadowPass.Render
m_LightLoop . BuildGPULightLists ( camera , cmd , m_CameraDepthStencilBufferRT , GetStencilTexture ( ) ) ;
// Output split lighting for materials asking for it (masked in the stencil buffer)
options . outputSplitLighting = true ;
m_LightLoop . RenderDeferredLighting ( hdCamera , cmd , m_DebugDisplaySettings , colorRTs , m_CameraDepthStencilBufferRT , depthTexture , m_DeferredDirShadowRT , options ) ;
m_LightLoop . RenderDeferredLighting ( hdCamera , cmd , m_DebugDisplaySettings , colorRTs , m_CameraDepthStencilBufferRT , depthTexture , m_DeferredShadowBuffer , options ) ;
m_LightLoop . RenderDeferredLighting ( hdCamera , cmd , m_DebugDisplaySettings , colorRTs , m_CameraDepthStencilBufferRT , depthTexture , m_DeferredDirShadowRT , options ) ;
m_LightLoop . RenderDeferredLighting ( hdCamera , cmd , m_DebugDisplaySettings , colorRTs , m_CameraDepthStencilBufferRT , depthTexture , m_DeferredShadowBuffer , options ) ;
}
// Combines specular lighting and diffuse lighting with subsurface scattering.