قالب وردپرس قالب وردپرس قالب فروشگاهی وردپرس وردپرس آموزش وردپرس

Unity Shadow Acne Bug: Artifacts in Shadow Maps and Reliable Fixes

Understanding Unity Animator: State Machines & Blend Trees
February 18, 2026
Unity Shader Variant Collection Bug: Missing Shaders in Builds
Unity Shader Variant Collection Bug: Missing Shaders in Builds
February 20, 2026

Unity Shadow Acne Bug: Artifacts in Shadow Maps and Reliable Fixes

You bake or enable real-time shadows, and suddenly surfaces are covered in strange dark lines, speckles, or striping patterns. The lighting looks dirty or unstable, especially when the camera moves.

This issue is commonly known as Shadow Acne. It is not a texture problem. It is not a broken material. It is a shadow map precision issue.

Let’s understand why it happens and how to fix it properly.

What Is Shadow Acne?

Shadow acne appears as dark artifacts on surfaces that should be evenly lit. It happens because the shadow map cannot perfectly distinguish between a surface and its own shadow.

In simple terms, the surface ends up casting a shadow onto itself.

Why It Happens

Shadow maps store depth information from the light’s point of view. Due to limited precision, tiny floating-point errors cause the renderer to think a surface is slightly behind itself. That causes incorrect shadowing.

Common causes:

  • Low shadow map resolution
  • Large camera far clip plane
  • Directional light covering huge areas
  • Insufficient shadow bias settings
  • Very thin geometry

Fix 1: Adjust Shadow Bias

Select your Light (usually Directional Light) and modify:

  • Bias
  • Normal Bias

Increasing Bias slightly pushes shadows away from surfaces.

Start with small adjustments:

  • Bias: 0.05 – 0.2
  • Normal Bias: 0.2 – 1

Be careful. Too much bias causes “peter panning” where shadows detach from objects.

Fix 2: Increase Shadow Resolution

Go to:

Edit → Project Settings → Quality

Increase Shadow Resolution to High or Very High.

Higher resolution reduces precision artifacts but increases GPU cost.

Fix 3: Reduce Shadow Distance

Large shadow distance reduces precision.

Go to:

Project Settings → Quality → Shadow Distance

Lower it to a reasonable range for your scene. For example:

  • Indoor game: 20–40
  • Outdoor game: 60–120

Smaller ranges improve shadow stability.

Fix 4: Adjust Camera Clip Planes

If your camera near clip plane is too small (e.g., 0.01), depth precision suffers.

Increase Near Clip Plane slightly:

  • 0.1 or 0.3 instead of 0.01

This improves depth buffer precision significantly.

Fix 5: Use Cascaded Shadows Properly

Directional lights often use Cascaded Shadow Maps (CSM).

Make sure cascades are configured properly:

  • 2 or 4 cascades for outdoor scenes
  • Balanced cascade splits

Improper cascade setup can amplify acne artifacts at cascade boundaries.

URP and HDRP Considerations

In URP:

  • Increase Shadow Resolution in the URP Asset
  • Adjust Depth Bias and Normal Bias in Light settings
  • Enable Soft Shadows carefully

In HDRP:

  • Adjust Slope-Scaled Depth Bias
  • Fine-tune Contact Shadows

Advanced Fix: Shader Offset (If Needed)

In rare cases, you may adjust rendering offsets in shaders.

Example:

Offset 1, 1

This shifts depth values slightly to reduce self-shadowing. Use carefully.

Common Mistakes

  • Increasing bias too much (causes floating shadows)
  • Using extremely large shadow distance
  • Ignoring camera near clip plane settings
  • Using very thin geometry that exaggerates precision issues

Quick Debug Checklist

  • Increase Bias slightly
  • Increase Shadow Resolution
  • Reduce Shadow Distance
  • Adjust camera Near Clip Plane
  • Verify cascade setup

Is Shadow Acne a Unity Bug?

No. It is a known limitation of shadow mapping techniques used in real-time rendering. Every engine that uses shadow maps encounters this issue.

The solution is balancing bias, resolution, and distance carefully.

Final Thoughts

Shadow acne is a precision problem, not a broken lighting system. With correct bias tuning, reasonable shadow distance, and proper resolution settings, you can eliminate most artifacts without sacrificing performance.

Always adjust settings gradually and test in motion, since artifacts often appear only while moving the camera.

Leave a Reply

Your email address will not be published. Required fields are marked *

Skip to toolbar