Global Cloud Shadows on Atmosphere Break

The video shows volumetric clouds near the equator. In the directional sunlight the function “cast cloud shadows” is enabled. The sky r.SkyAtmosphere.FastSkyLUT is also enabled (disabling it fixes it bug tanks the performance). The cloud shadows on the atmosphere seem to change erratically depending on the camera angle.

Does someone know how to fix this?

SebHillaire answered in another threat. The shadows are designed to work only ontop of the planet, (though they also seem to work fine on the south pole too)

I got a fix for this and another bug that happens with planets.
If it’s not urgent for your Epic has made a bug report to fix the SkyAtmosphere Cloud Shadows and the Ambient Light for planets, which eventually be fixed in Vanilla UE estimated for 5.7 (probably in a year).

To fix the SkyAtmosphere Cloud Shadows for planets:
In SkyAtmosphere.usf, on lines 672 and 711, the comments mention using the inverse of the LocalReferential, but proceed to use the LocalReferential without inverting it. Using the inverse fixes the shadows around the planet. So my simple fix would be this:

// Default matrix inversion that oddly doesn't exist already in UE
float3x3 Inverse3x3(float3x3 m) {
    float3x3 inv;
    float det = m[0][0] * (m[1][1] * m[2][2] - m[1][2] * m[2][1]) -
                m[0][1] * (m[1][0] * m[2][2] - m[1][2] * m[2][0]) +
                m[0][2] * (m[1][0] * m[2][1] - m[1][1] * m[2][0]);
 
    float invDet = 1.0 / det;
 
    inv[0][0] = (m[1][1] * m[2][2] - m[1][2] * m[2][1]) * invDet;
    inv[0][1] = (m[0][2] * m[2][1] - m[0][1] * m[2][2]) * invDet;
    inv[0][2] = (m[0][1] * m[1][2] - m[0][2] * m[1][1]) * invDet;
 
    inv[1][0] = (m[1][2] * m[2][0] - m[1][0] * m[2][2]) * invDet;
    inv[1][1] = (m[0][0] * m[2][2] - m[0][2] * m[2][0]) * invDet;
    inv[1][2] = (m[0][2] * m[1][0] - m[0][0] * m[1][2]) * invDet;
 
    inv[2][0] = (m[1][0] * m[2][1] - m[1][1] * m[2][0]) * invDet;
    inv[2][1] = (m[0][1] * m[2][0] - m[0][0] * m[2][1]) * invDet;
    inv[2][2] = (m[0][0] * m[1][1] - m[0][1] * m[1][0]) * invDet;
 
    return inv;
}
 
float3x3 InverseLocalReferencial = Inverse3x3(LocalReferencial);
 
ShadowP0 = GetTranslatedCameraPlanetPos() + t * mul(InverseLocalReferencial, WorldDir); // Inverse of the local SkyViewLUT referencial transform
ShadowP1 = GetTranslatedCameraPlanetPos() + t * mul(InverseLocalReferencial, WorldDir); // Inverse of the local SkyViewLUT referencial transform

To fix the ambient light color of clouds for planets, in the SkyAtmosphere shader change the RenderDistantSkyLightLutCS SamplePos to:

float3 SamplePos = normalize(GetTranslatedCameraPlanetPos())* (Atmosphere.BottomRadiusKm + DistantSkyLightSampleAltitude);

And in the SkyAtmosphereRendering.cpp add the ViewUniformBuffer to the input parameters of the FRenderDistantSkyLightLutCS, so we can get the camera position.

I hope it helps.