Kaira Digital ArtsKaira Digital Arts
Sayfalar (23)Cloud shadows

Cloud shadows

Son güncelleme: 6 Ekim 2026

Bu sayfa henüz Türkçeye çevrilmedi, İngilizcesi gösteriliyor.

With cloud shadows on, the clouds darken the ground beneath them. A small mask is drawn from the sun's point of view (the 2D layer from its own pattern, the 3D pieces with the same shapes they are drawn with) and assigned to the sun light as a directional light cookie. At night the moon light carries it, if you have one.

Every surface lit by URP receives the shadow: Lit and Simple Lit materials, terrain, Shader Graph and the demo water. Only the direct light is reduced, so shadowed ground keeps its ambient light, and the shadows drift with the same wind as the clouds.

Settings are in the Cloud Shadows (Ground) section of the Cloud Module.

Requirements

  • Light Cookies must be enabled on the URP asset. The Quick Start window checks this and enables it with one click.
  • While cloud shadows are on they replace any cookie you had on the sun light, and put it back when they are switched off.
  • The 3D cloud material needs GPU Instancing enabled. The inspector warns if it is off.

Settings

SettingDefaultDescription
enableCloudShadowsonMaster switch
groundShadow3D, groundShadow2Don, onWhich layers cast. A hidden or empty layer casts nothing by itself
groundShadowStrength0.650 to 1. 1 removes all direct sunlight under a dense cloud. Can follow a 24 hour curve
groundShadowSoftness40Blur radius in meters. 0 keeps the raw shapes
groundShadowCloudAltitude (2D Cloud Altitude)1200Height in meters of the plane the 2D layer is projected from. Lower gives a smaller pattern
groundShadowNightStrength0.35Multiplier while the moon light is active
groundShadowMinSunAngle (Fade Below Sun Angle)8Below this sun elevation in degrees the shadows fade out, because near the horizon a cloud shadow stretches for kilometers
groundShadowResolution (Mask Resolution)1024Mask size: 512, 1024 or 2048
groundShadowRange2500Side of the square area around the player that receives shadows, in meters. Outside it the ground is lit evenly
groundShadowUpdateInterval (Update Every N Frames)1Redraws the mask every N frames, 1 to 4. Clouds move slowly, so 2 halves the cost with no visible change
groundShadowPreviewInEditoronAlso shows the shadows in the Scene view outside Play Mode

With heavy 2D cover the whole area can look evenly dimmed rather than patterned, because one pattern tile covers a large part of the ground. Lower 2D Cloud Altitude (600 to 800 m) for a smaller, more readable pattern.

Cost

One small off-screen mask: roughly 0.1 to 0.3 ms of GPU time at 1024 (less with a higher update interval or a lower resolution), plus one cookie texture read in every lit shader. Memory is about 1 MB at 1024. Turning the feature on enables URP's light cookie shader variant for the frame. These are estimates, so measure on your target hardware. The status line under Cloud Shadows shows the mask size and the number of pieces, or why the shadows are not rendering.

Custom shaders

URP passes the shadow through the main light cookie. A custom lit shader receives it when it uses the GetMainLight overload that takes the world position, and compiles the light cookie variant:

hlsl
#pragma multi_compile_fragment _ _LIGHT_COOKIES

Light mainLight = GetMainLight(TransformWorldToShadowCoord(positionWS), positionWS, half4(1, 1, 1, 1));

The one argument overload of GetMainLight never applies cookies.

Public API

MemberDescription
bool CloudShadowsActiveWhether a light currently carries the cloud shadow cookie
Light CloudShadowLightThat light, or null
string GetCloudShadowStatusText()The status line from the inspector

Bu sayfaya bağlantı veren sayfalar

Hâlâ takıldınız mı?

Unity sürümünüzü, render pipeline bilginizi ve sorunun ekran görüntüsünü gönderin.

Destek alın