New injection point "After Opaque and Sky" drawn out of order

After a long wait for the new injection point “After Opaque and Sky”, I was eager to try this today in the latest HDRP 14 and Unity 2022.3.5 LTS.

We desperately needed this injection point, to correctly draw our Stars VFX before the Local Volumetric Clouds (HDRP clouds).

But to my dismay, after switching to this new injection point for our stars, they are still being draw AFTER the local volumetric clouds.

It means that this documentation is incorrect, or that there is a bug that causes the injection point to happen at the wrong place:

Here is our clouds in the day time for reference:

And here is our attempt to draw the stars, THEN the clouds:

As you can see, it is drawing the local clouds, THEN the stars - despite choosing the injection point that would have you believe otherwise.

For further reference, here’s the original discussion around the new injection point:

Discussion - Can we please get this new injection point in HDRP 14? - Unity Forum

2 Likes

So I did some more tests to make absolutely sure this is broken…

Here I have a box high above the clouds. Left image is game view, right is scene view, to make the setup clear.

The clouds are very thick. For example, you will notice it blocks the “sun object” in the sky (an opaque deferred sphere object rendered the usual way). Notice that with the clouds removed or added, the red box is visible and unchanged, meaning that the red box is rendered after the local volumetric clouds.

In this test, I have added the red box to the Stars layer. The camera does not render this layer directly. It is only rendered in the Custom Pass, which is set to “After Opaque and Sky”. Refer to my previous post which clearly shows this injection point happening after sky, and before volumetric clouds.

2 Likes

Hello,

Thanks for the report, there is indeed an error in Unity 2022.3 and 2023.1 regarding the internal location of the injection point. It’s being fixed right now and should be available soon in the following patch releases

Thanks a lot - I have also submitted a bug report, so if the report comes through or is a duplicate, I will drop it here if that will help.

1 Like

The fix has landed in Unity 2022.3.8f1 and 2023.1.9f1 it should be available in a week or two.

3 Likes

I notice that 2022.3.6 just released yesterday. So I’m assuming that 2022.3.7 will come out in a week or two, and not 2022.3.8?

Yeah, that would probably be the case. Final releases usually take a bit more time to get released.

HDRP: Fixed custom pass injection point “After Opaque And Sky” happening after cloud rendering.
(Unity 2023.1.9)

However, I’m on 2023.1.10f1 and after a quick try I still can’t manage to make this work.
Can someone else please confirm if they tried it and it’s fixed? Even a rough outline of what you did would be appreciated.

I’m waiting for 2022.3.8 where it will be fixed (I’m not on 2023.x). Once I have that, I will check it and confirm the outcome.

1 Like

Hey, so there was a problem in the backport of the fix for 22.3 causing the fog (not clouds) to be rendered after the injection point. A fix for this issue will land in the 2022.3.10f1

Oh I forgot to mention - it works in 2022.3.8.

1 Like

Can you help me how to draw a gameObject inside the volumetric clouds? It looks like under the latest unity 2022, the gameObject always drawn after the clouds, like the clouds will be a background layer or something

9722059--1389805--upload_2024-3-24_11-50-35.png

Make sure the rendering space is set to world in the visual environement, otherwise the camera cannot go inside the clouds

Is it possible to render something behind the cloud layers? I’m able to get objects to render behind volumetric clouds but I can’t get it to work the same with cloud layers.

no that’s not possible, except if you render it as part of the sky. What kind of object do you want to render ? if it’s simply a texture, you can make a custom pbr sky shadergraph and do anything you want inside

It’s a shader of a shifting star night/milky way type effect that renders fine behind volumetric clouds but I can only sort of make it work with cloud layers by setting it to additive against the clouds Which renders in front of them :frowning:
PBR shadergraph sky has the same settings as cloud layer? So if it were a single starry texture there’s a way to edit the actual cloud layers with this in shadergraph?

The order of rendering is sky, then clouds, so if you want something to appear behind the clouds, you need to render it as part of the sky.
The sky shader is executed as a full screen pass, you can use the view direction node to make a custom effect
I’ve attached an example shadergraph that can be used to project a texture on the skybox, it’s probably not what you want to do exactly but it’s simply to show what’s possible

9848652–1417671–Shadergraph.zip (6.31 KB)

Then it can be assigned to the sky by setting the material in the volume override

Actually you can also render your object using the After Opaque and Sky injection point (which was the original topic :smile:) that might be easier

Hmm…I’m using 2022 LTS HDRP. I don’t see what you posted. Is this 2023 only? We won’t be updating to Unity 6.
I see this: