m_DeferredDirectMaterialSRT . EnableKeyword ( "LIGHTLOOP_TILE_PASS" ) ;
m_DeferredDirectMaterialSRT . DisableKeyword ( "OUTPUT_SPLIT_LIGHTING" ) ;
m_DeferredDirectMaterialSRT . SetInt ( "_StencilRef" , ( int ) StencilBits . Standard ) ;
m_DeferredDirectMaterialSRT . SetInt ( "_StencilCmp" , 7 /* GEqual */ ) ;
m_DeferredDirectMaterialSRT . SetInt ( "_SrcBlend" , ( int ) BlendMode . One ) ;
m_DeferredDirectMaterialSRT . SetInt ( "_DstBlend" , ( int ) BlendMode . Zero ) ;
m_DeferredDirectMaterialMRT . EnableKeyword ( "OUTPUT_SPLIT_LIGHTING" ) ;
m_DeferredDirectMaterialMRT . SetInt ( "_StencilRef" , ( int ) StencilBits . SSS ) ;
m_DeferredDirectMaterialMRT . SetInt ( "_StencilCmp" , 3 /* Equal */ ) ;
m_DeferredDirectMaterialMRT . SetInt ( "_SrcBlend" , ( int ) BlendMode . One ) ;
m_DeferredDirectMaterialMRT . SetInt ( "_DstBlend" , ( int ) BlendMode . Zero ) ;
m_DeferredIndirectMaterialSRT . DisableKeyword ( "OUTPUT_SPLIT_LIGHTING" ) ;
m_DeferredIndirectMaterialSRT . SetInt ( "_StencilRef" , ( int ) StencilBits . Standard ) ;
m_DeferredIndirectMaterialSRT . SetInt ( "_StencilCmp" , 7 /* GEqual */ ) ;
m_DeferredIndirectMaterialSRT . SetInt ( "_SrcBlend" , ( int ) BlendMode . One ) ;
m_DeferredIndirectMaterialSRT . SetInt ( "_DstBlend" , ( int ) BlendMode . One ) ; // Additive color & alpha source
m_DeferredIndirectMaterialMRT . EnableKeyword ( "OUTPUT_SPLIT_LIGHTING" ) ;
m_DeferredIndirectMaterialMRT . SetInt ( "_StencilRef" , ( int ) StencilBits . SSS ) ;
m_DeferredIndirectMaterialMRT . SetInt ( "_StencilCmp" , 3 /* Equal */ ) ;
m_DeferredIndirectMaterialMRT . SetInt ( "_SrcBlend" , ( int ) BlendMode . One ) ;
m_DeferredIndirectMaterialMRT . SetInt ( "_DstBlend" , ( int ) BlendMode . One ) ; // Additive color & alpha source
m_DeferredAllMaterialSRT . DisableKeyword ( "OUTPUT_SPLIT_LIGHTING" ) ;
m_DeferredAllMaterialSRT . SetInt ( "_StencilRef" , ( int ) StencilBits . Standard ) ;
m_DeferredAllMaterialSRT . SetInt ( "_StencilCmp" , 7 /* GEqual */ ) ;
m_DeferredAllMaterialSRT . SetInt ( "_SrcBlend" , ( int ) BlendMode . One ) ;
m_DeferredAllMaterialSRT . SetInt ( "_DstBlend" , ( int ) BlendMode . Zero ) ;
m_DeferredAllMaterialMRT . EnableKeyword ( "OUTPUT_SPLIT_LIGHTING" ) ;
m_DeferredAllMaterialMRT . SetInt ( "_StencilRef" , ( int ) StencilBits . SSS ) ;
m_DeferredAllMaterialMRT . SetInt ( "_StencilCmp" , 3 /* Equal */ ) ;
m_DeferredAllMaterialMRT . SetInt ( "_SrcBlend" , ( int ) BlendMode . One ) ;
m_DeferredAllMaterialMRT . SetInt ( "_DstBlend" , ( int ) BlendMode . Zero ) ;
m_SingleDeferredMaterialSRT . EnableKeyword ( "LIGHTLOOP_SINGLE_PASS" ) ;
m_SingleDeferredMaterialSRT . DisableKeyword ( "OUTPUT_SPLIT_LIGHTING" ) ;
m_SingleDeferredMaterialSRT . SetInt ( "_StencilRef" , ( int ) StencilBits . Standard ) ;
m_SingleDeferredMaterialSRT . SetInt ( "_StencilCmp" , 7 /* GEqual */ ) ;
m_SingleDeferredMaterialSRT . SetInt ( "_SrcBlend" , ( int ) BlendMode . One ) ;
m_SingleDeferredMaterialSRT . SetInt ( "_DstBlend" , ( int ) BlendMode . Zero ) ;
m_SingleDeferredMaterialMRT . SetInt ( "_StencilRef" , ( int ) StencilBits . SSS ) ;
m_SingleDeferredMaterialMRT . SetInt ( "_StencilCmp" , 3 /* Equal */ ) ;
m_SingleDeferredMaterialMRT . SetInt ( "_SrcBlend" , ( int ) BlendMode . One ) ;
m_SingleDeferredMaterialMRT . SetInt ( "_DstBlend" , ( int ) BlendMode . Zero ) ;
public override void RenderDeferredLighting ( HDCamera hdCamera , ScriptableRenderContext renderContext ,
LightingDebugParameters lightDebugParameters ,
RenderTargetIdentifier [ ] colorBuffers , RenderTargetIdentifier stencilBuffer ,
bool outputSplitLighting )
bool outputSplitLightingForSSS , bool enableSSS )
{
var bUseClusteredForDeferred = ! usingFptl ;
if ( m_PassSettings . disableTileAndCluster )
{
// This is a debug brute force renderer to debug tile/cluster which render all the lights
if ( outputSplitLighting )
if ( outputSplitLightingForSSS )
m_SingleDeferredMaterialSRT . SetInt ( "_StencilRef" , ( int ) ( enableSSS ? StencilBits . Standard : StencilBits . SSS ) ) ;
Utilities . DrawFullScreen ( cmd , m_SingleDeferredMaterialSRT , hdCamera , colorBuffers [ 0 ] , stencilBuffer ) ;
}
}
// Pixel shader evaluation
if ( m_PassSettings . enableSplitLightEvaluation )
{
if ( outputSplitLighting )
if ( outputSplitLightingForSSS )
{
Utilities . SelectKeyword ( m_DeferredDirectMaterialMRT , "USE_CLUSTERED_LIGHTLIST" , "USE_FPTL_LIGHTLIST" , bUseClusteredForDeferred ) ;
Utilities . DrawFullScreen ( cmd , m_DeferredDirectMaterialMRT , hdCamera , colorBuffers , stencilBuffer ) ;
}
else
{
m_DeferredDirectMaterialSRT . SetInt ( "_StencilRef" , ( int ) ( enableSSS ? StencilBits . Standard : StencilBits . SSS ) ) ;
m_DeferredIndirectMaterialSRT . SetInt ( "_StencilRef" , ( int ) ( enableSSS ? StencilBits . Standard : StencilBits . SSS ) ) ;
Utilities . SelectKeyword ( m_DeferredIndirectMaterialSRT , "USE_CLUSTERED_LIGHTLIST" , "USE_FPTL_LIGHTLIST" , bUseClusteredForDeferred ) ;
Utilities . DrawFullScreen ( cmd , m_DeferredIndirectMaterialSRT , hdCamera , colorBuffers [ 0 ] , stencilBuffer ) ;
}
if ( outputSplitLighting )
if ( outputSplitLightingForSSS )
{
Utilities . SelectKeyword ( m_DeferredAllMaterialMRT , "USE_CLUSTERED_LIGHTLIST" , "USE_FPTL_LIGHTLIST" , bUseClusteredForDeferred ) ;
Utilities . DrawFullScreen ( cmd , m_DeferredAllMaterialMRT , hdCamera , colorBuffers , stencilBuffer ) ;
m_DeferredAllMaterialSRT . SetInt ( "_StencilRef" , ( int ) ( enableSSS ? StencilBits . Standard : StencilBits . SSS ) ) ;
Utilities . SelectKeyword ( m_DeferredAllMaterialSRT , "USE_CLUSTERED_LIGHTLIST" , "USE_FPTL_LIGHTLIST" , bUseClusteredForDeferred ) ;
Utilities . DrawFullScreen ( cmd , m_DeferredAllMaterialSRT , hdCamera , colorBuffers [ 0 ] , stencilBuffer ) ;
}