Black flickering noise near alpha clipped edges when volumetric clouds with ghosting reduction is enabled

Hi @chap-unity :hot_beverage:

I’m tagging you here to continue our discussion. I unintentionally hijacked the other thread regarding cloud rendering issues, but my issue is slightly different from the OP of that thread, so I will make a clear thread here with an isolated video showing the issue + conditions to repro.

The following conditions must both be met for the flickering to happen:

  1. Clear sky visible behind the alpha clipped surface (i.e. thick cloud in the background will remove the flickering noise) - First half of video
  2. The camera must not be rotating. As soon as even the slightest rotation is introduced, the flickering disappears completely - Second half of video

Following on from the other thread - the issue persists in both Camera and World space modes under the Planet settings.

This is all the information that I have so far. If you think this is enough, I will go ahead and create a Bug report - but I can’t attach the project shown in the video for repro purposes. What do you think?

Thanks for the detailled video.
It appears that this is the same issue that is already known and logged on our side (I’ve just put the issue to public right now so it will take a few hours for the link to show something).

We will have a look and you can follow the state of the bug on the link above.
Hopefully, it won’t take long.

Hi @chap-unity - I’m just checking in to see if this issue will hopefully get some attention soon. It’s been a good 6 months or so since this flickering mayhem has been reported. Would be nice to see it resolved :hot_beverage:

Unity Issue Tracker - Artifacts are visible when moving and viewing Alpha Clipped Geometry in front of Volumetric Clouds

Very sad to see this issue has been marked as Won’t Fix.

I’m still concerned that my case above (the video) might potentially be a slightly different case from the one in the bug ticket.

The problem is so severe, that’s it’s hard to imagine shipping a game with such black spots flickering heavily through the trees.

Also a point that may have been missed by whoever evaluated this, is that the black spots do not appear over clouds - they appear when there are no clouds visible behind the alpha clipped surface + no camera movement.

@chap-unity I put Claude on this and the issue seems entirely fixed.

In case its helpful, here’s the summary:

Volumetric Clouds — fix dark-speckle flicker on alpha-clipped edges (ghosting reduction)

File: Packages/com.unity.render-pipelines.high-definition@<hash>/Runtime/Lighting/VolumetricClouds/VolumetricClouds.compute

Kernel: ReprojectCloudsRejection (the WITH_REJECTION path of REPROJECT_CLOUDS, used only when Ghosting Reduction is enabled)

Location: inside the #ifdef WITH_REJECTION block of REPROJECT_CLOUDS (~line 98).

Problem: At thin alpha-clipped foliage edges against clear sky, the checkerboard depth classification can leave a sky-classified center pixel with zero neighbors of matching classification. The neighborhood min/max box is then never initialized and stays inverted (min.w = 1.0, max.w = 0.0). ClipCloudsToRegionclamp(history.w, 1.0, 0.0) collapses transmittance to 0, forcing an opaque pixel (black where there is no cloud light) that locks into temporal accumulation → dark flicker speckle.

Change: Count valid neighbors during the 3×3 gather and only call ClipCloudsToRegion when at least one was found.

Diff:

        #ifdef WITH_REJECTION
        float4 lightingMin = float4(FLT_MAX, FLT_MAX, FLT_MAX, 1.0);
        float4 lightingMax = float4(0, 0, 0, 0.0);
+       int validNeighborCount = 0;
        for (int y = -1; y <= 1; ++y)
        {
            for (int x = -1; x <= 1; ++x)
            {
                CloudReprojectionData data = GetCloudReprojectionDataSample(threadCoord, int2(x, y));
                if ((data.pixelDepth == UNITY_RAW_FAR_CLIP_VALUE) == (currentSceneDepth == UNITY_RAW_FAR_CLIP_VALUE))
                {
                    lightingMin = min(lightingMin, data.cloudLighting);
                    lightingMax = max(lightingMax, data.cloudLighting);
+                   validNeighborCount++;
                }
            }
        }

-       previousColor = ClipCloudsToRegion(previousColor, lightingMin, lightingMax, validityFactor);
+       // Only clip against the neighborhood when we actually gathered one. [see comment in file]
+       if (validNeighborCount > 0)
+           previousColor = ClipCloudsToRegion(previousColor, lightingMin, lightingMax, validityFactor);
        #endif

Risk/side-effects: When no valid neighbor exists (rare, single-frame), the reprojected history is trusted un-clamped — at most a pixel of mild ghosting on that frame, versus a locked-in black flash. No API or signature changes; no other files touched.

Verified against HDRP version: 17.3.0 (com.unity.render-pipelines.high-definition@760a5b94e0f4).

Hey thanks, you are right. FYI this is already fixed in a slightly different way in the latest version but we were only allowed to backport it up to 6.4. (so 6.4, 6.5, 6.6 and 6.7)

So it’s not fixed in latest 6.3 LTS and cannot be sadly.

Either way, you can keep yours or compare it with the slightly different one in the later LTS.

Here’s “our version” if you are curious.

Thanks the 6.3 backport is not a big deal since we will eventually land on the latest 6.x LTS anyway :hot_beverage:

this causes ghosting in high contrast areas (ghosting reduction is on):

repro:
1.enable volumetric clouds
2.put some primitives on the scene
3.set up indirect lighting multiplier to something really low like 0.01 to create contrast
3.observe the ghosting when camera is moving around the primitives

yet still somehow flickers

I think the bright flickers issue is a different one from my issue which specifically has to do with dark pixels flickering when viewing a clear sky through alpha clipped geometry while volumetric clouds is enabled.

At once point, a bunch of cloud flickering issues got mixed up probably.

Also see this older thread that looks a lot more like what you are showing here:

Artifacts caused by volumetric clouds (sky is visible through clouds around alpha-clipped objects) - Unity Engine - Unity Discussions

Are you using the fixed Unity versions later than 6.3? Or trying to apply a fix manually?

Yes, I understand this thread is rather about this:


Which both your and chap’s solution are managing to solve completely. However, yours doesn’t generate ghosting artifacts shown here unlike the official one, so please pay attention, @chap-unity

At the same time, they both have no effect on the ‘bright flicker’ as you name it from here and there, if applied manually in 6.3. However, the flicker is absent starting 6000.4.0f1 - I’ve just re-checked with the latest 6.6, importing the project from this post and it was ok, no sign of the flicker with various sprites. So yes, those are separate issues I’m afraid. Question is what was changed in the later versions which led to the fix of it apart from that chap’s commit? Maybe that would also be the answer why it cannot be fully backported.

Thanks for the investigations. I’ll compare both solutions to confirm your findings and do my best to fix it if that’s indeed better.