@@ -360,18 +360,17 @@ void RenderGBuffer(CullResults cull, Camera camera, RenderLoop renderLoop)
360
360
}
361
361
362
362
// This pass is use in case of forward opaque and deferred rendering. We need to render forward objects before tile lighting pass
363
- void RenderForwardOpaqueDepth ( CullResults cull , Camera camera , RenderLoop renderLoop )
363
+ void RenderForwardOnlyDepthPrepass ( CullResults cull , Camera camera , RenderLoop renderLoop )
364
364
{
365
- // If we have render a depth prepass, no need for this pass
366
- if ( debugParameters . useDepthPrepass )
365
+ // If we are forward only we don't need to render ForwardOpaqueDepth object
366
+ // But in case we request a prepass we render it
367
+ if ( debugParameters . useForwardRenderingOnly && ! debugParameters . useDepthPrepass )
367
368
return ;
368
369
369
370
using ( new Utilities . ProfilingSample ( "Forward opaque depth" , renderLoop ) )
370
371
{
371
- // TODO: Use the render queue index to only send the forward opaque!
372
- // or use the new MAterial.SetPassEnable ?
373
372
Utilities . SetRenderTarget ( renderLoop , m_CameraDepthBufferRT ) ;
374
- RenderOpaqueRenderList ( cull , camera , renderLoop , "DepthOnly " ) ;
373
+ RenderOpaqueRenderList ( cull , camera , renderLoop , "ForwardOnlyDepthOnly " ) ;
375
374
}
376
375
}
377
376
@@ -462,6 +461,22 @@ void RenderForward(CullResults cullResults, Camera camera, RenderLoop renderLoop
462
461
}
463
462
}
464
463
464
+ // Render material that are forward opaque only (like eye)
465
+ // TODO: Think about hair that could be render both as opaque and transparent...
466
+ void RenderForwardOnly ( CullResults cullResults , Camera camera , RenderLoop renderLoop )
467
+ {
468
+ using ( new Utilities . ProfilingSample ( "Forward Only Pass" , renderLoop ) )
469
+ {
470
+ // Bind material data
471
+ m_LitRenderLoop . Bind ( ) ;
472
+
473
+ Utilities . SetRenderTarget ( renderLoop , m_CameraColorBufferRT , m_CameraDepthBufferRT ) ;
474
+
475
+ m_lightLoop . RenderForward ( camera , renderLoop , true ) ;
476
+ RenderOpaqueRenderList ( cullResults , camera , renderLoop , "ForwardOnly" ) ;
477
+ }
478
+ }
479
+
465
480
void RenderForwardUnlit ( CullResults cullResults , Camera camera , RenderLoop renderLoop )
466
481
{
467
482
using ( new Utilities . ProfilingSample ( "Forward Unlit Pass" , renderLoop ) )
@@ -651,16 +666,11 @@ public override void Render(Camera[] cameras, RenderLoop renderLoop)
651
666
652
667
RenderDepthPrepass ( cullResults , camera , renderLoop ) ;
653
668
654
- RenderGBuffer ( cullResults , camera , renderLoop ) ;
655
-
656
- // Forward opaque with deferred tile require that we fill the depth buffer
669
+ // Forward opaque with deferred/cluster tile require that we fill the depth buffer
657
670
// correctly to build the light list.
658
671
// TODO: avoid double lighting by tagging stencil or gbuffer that we must not lit.
659
- // TODO: ask Morten why this pass is not before GBuffer ? Will make more sense and avoid
660
- // to do gbuffer pass on unseen mesh.
661
- // TODO: how do we select only the object that must be render forward ?
662
- // this is all object with gbuffer pass disabled ?
663
- //RenderForwardOpaqueDepth(cullResults, camera, renderLoop);
672
+ RenderForwardOnlyDepthPrepass ( cullResults , camera , renderLoop ) ;
673
+ RenderGBuffer ( cullResults , camera , renderLoop ) ;
664
674
665
675
if ( debugParameters . debugViewMaterial != 0 )
666
676
{
@@ -685,8 +695,8 @@ public override void Render(Camera[] cameras, RenderLoop renderLoop)
685
695
}
686
696
RenderDeferredLighting ( camera , renderLoop ) ;
687
697
688
- // TODO: enable this for tile forward opaque
689
- // RenderForward (cullResults, camera, renderLoop, true );
698
+ RenderForward ( cullResults , camera , renderLoop , true ) ;
699
+ RenderForwardOnly ( cullResults , camera , renderLoop ) ;
690
700
691
701
RenderSky ( camera , renderLoop ) ;
692
702
0 commit comments