private RenderPassAttachment s_GBufferSpecRough ;
private RenderPassAttachment s_GBufferNormal ;
private RenderPassAttachment s_GBufferEmission ;
private RenderPassAttachment s_GBufferZ ;
private RenderPassAttachment s_CameraTarget ;
private RenderPassAttachment s_Depth ;
public void Build ( )
{
s_GBufferAlbedo = new RenderPassAttachment ( RenderTextureFormat . ARGB32 ) ;
s_GBufferSpecRough = new RenderPassAttachment ( RenderTextureFormat . ARGB32 ) ;
s_GBufferNormal = new RenderPassAttachment ( RenderTextureFormat . ARGB2101010 ) ;
s_GBufferEmission = new RenderPassAttachment ( RenderTextureFormat . ARGBHalf ) ;
s_GBufferZ = new RenderPassAttachment ( RenderTextureFormat . Depth ) ;
s_GBufferAlbedo = new RenderPassAttachment ( RenderTextureFormat . ARGB32 ) { hideFlags = HideFlags . HideAndDontSave } ;
s_GBufferSpecRough = new RenderPassAttachment ( RenderTextureFormat . ARGB32 ) { hideFlags = HideFlags . HideAndDontSave } ;
s_GBufferNormal = new RenderPassAttachment ( RenderTextureFormat . ARGB2101010 ) { hideFlags = HideFlags . HideAndDontSave } ;
s_GBufferEmission = new RenderPassAttachment ( RenderTextureFormat . ARGBHalf ) { hideFlags = HideFlags . HideAndDontSave } ;
s_Depth = new RenderPassAttachment ( RenderTextureFormat . Depth ) { hideFlags = HideFlags . HideAndDontSave } ;
s_Depth = new RenderPassAttachment ( RenderTextureFormat . Depth ) ;
s_GBufferZ . Clear ( new Color ( ) , 1.0f , 0 ) ;
s_Depth . Clear ( new Color ( ) , 1.0f , 0 ) ;
if ( SystemInfo . supportsReadOnlyDepth )
{
{
s_GBufferRedF32 = new RenderPassAttachment ( RenderTextureFormat . RFloat ) ;
s_GBufferRedF32 = new RenderPassAttachment ( RenderTextureFormat . RFloat ) { hideFlags = HideFlags . HideAndDontSave } ;
s_GBufferRedF32 . Clear ( new Color ( ) , 1.0f , 0 ) ;
}
context . ExecuteCommandBuffer ( cmd ) ;
}
s_CameraTarget . BindSurface ( new RenderTargetIdentifier ( _sceneViewBlitId ) , false , true ) ;
s_Depth . BindSurface ( new RenderTargetIdentifier ( _sceneViewDepthId ) , false , tru e) ;
s_Depth . BindSurface ( new RenderTargetIdentifier ( _sceneViewDepthId ) , false , fals e) ;
}
else
{
}
}
context . Submit ( ) ;
context . Submit ( ) ;
}
void ExecuteRenderLoop ( Camera camera , CullResults cullResults , ScriptableRenderContext loop )
}
//Lighting Pass
using ( new RenderPass . SubPass ( rp , new [ ] { s_GBufferEmission } , SystemInfo . supportsReadOnlyDepth ?
new [ ] { s_GBufferAlbedo , s_GBufferSpecRough , s_GBufferNormal , s_GBufferEmission , s_Depth } :
new [ ] { s_GBufferAlbedo , s_GBufferSpecRough , s_GBufferNormal , s_GBufferEmission , s_GBufferRedF32 } , true ) )
using ( new RenderPass . SubPass ( rp , new [ ] { s_GBufferEmission } ,
new [ ] { s_GBufferAlbedo , s_GBufferSpecRough , s_GBufferNormal , SystemInfo . supportsReadOnlyDepth ? s_Depth : s_GBufferRedF32 } , true ) )
{
using ( var cmd = new CommandBuffer { name = "Deferred Lighting and Reflections Pass" } )
{
}
//Single Pass Forward Transparencies
using ( new RenderPass . SubPass ( rp , new [ ] { s_GBufferEmission } , new [ ] { s_GB ufferA lbedo , s_GBufferSpecRough , s_GBufferNormal , s_GBufferEmission } ) )
using ( new RenderPass . SubPass ( rp , new [ ] { s_GBufferEmission } , null ) )
{
using ( var cmd = new CommandBuffer { name = "Forwward Lighting Setup" } )
{
}
//Final pass
loop . SetupCameraProperties ( camera ) ;
using ( new RenderPass . SubPass ( rp , new [ ] { s_CameraTarget } , new [ ] { s_GBufferEmission } ) )
{
var cmd = new CommandBuffer { name = "FinalPass" } ;