#Shadowmasks broken after 2022.3->Unity 6 update unless compatibility mode is enabled

1 messages · Page 1 of 1 (latest)

fleet sundial
#

Howdy!
We recently updated from 2022.3.62 to 6000.0.62 & urp 17.0.4. We'd like to leverage the new render graph API, but shadowmasked lights seem to be broken.

Looking at a frame in RenderDoc, in the GBuffer pass it looks like the shadowmask buffer is being written to a temp buffer rather than one of the GBuffer targets. (screenshot 1)

If I add a SetGlobalTextureAfterPass call in GBufferPass.hlsl for the gbuffer element corresponding to m_DeferredLights.GBufferShadowMask, I see the output is corrected to _GBuffer6 (screenshot 2)

However, the Render Deferred Lighting/Deferred Shading pass for the relevant light does not show _GBuffer6 as an input, despite DeferredPass.Render calling SetupInputAttachment on the resource correctly, AFAIK.

#

Additionally, it seems like in StencilDeferred.hlsl, the shadowmask is always assumed to be in GBuffer4 when render passes are enabled?

...
#if defined(_DEFERRED_MIXED_LIGHTING)
...
shadowMask = LOAD_FRAMEBUFFER_X_INPUT(GBUFFER4, input.positionCS.xy);```
fleet sundial
#

Whereas in UnityGBuffer.hlsl:

    #define GBUFFER_OPTIONAL_SLOT_1 GBuffer4
    #define GBUFFER_OPTIONAL_SLOT_1_TYPE float
    #if OUTPUT_SHADOWMASK && (defined(_WRITE_RENDERING_LAYERS) || defined(_LIGHT_LAYERS))
        #define GBUFFER_OPTIONAL_SLOT_2 GBuffer5
        #define GBUFFER_OPTIONAL_SLOT_3 GBuffer6
        #define GBUFFER_LIGHT_LAYERS GBuffer5
        #define GBUFFER_SHADOWMASK GBuffer6
    #elif OUTPUT_SHADOWMASK
        #define GBUFFER_OPTIONAL_SLOT_2 GBuffer5
        #define GBUFFER_SHADOWMASK GBuffer5
    #elif (defined(_WRITE_RENDERING_LAYERS) || defined(_LIGHT_LAYERS))
        #define GBUFFER_OPTIONAL_SLOT_2 GBuffer5
        #define GBUFFER_LIGHT_LAYERS GBuffer5
    #endif //#if OUTPUT_SHADOWMASK && defined(_WRITE_RENDERING_LAYERS)
#else```

I see GBUFFER_SHADOWMASK Correctly defined as GBuffer6 (we're using shadowmasks, rendering layers/light layers)