Skip to content

some shadow maps have an outline artifact around their edges #32708

@trusktr

Description

@trusktr

Description

A couple examples:

Reproduction steps

  1. Here's the webgpu VSM example with some debug helpers enabled, and also the spotlight frustum is tighter to more closely encompass the example: https://jsfiddle.net/s79ack12
    No issue so yet:
    Image
  2. When we tighten up the spotlight's shadow.focus, we can see a line at the edge of the spotlight's shadow map area: https://jsfiddle.net/zm53Ladu (line 87)
    This is not typical shadow acne, as it happens exclusively along the edge of the shadow map area:
    Image
  3. A workaround is to patch THREE.ShadowNode.prototype.setupShadowFilter to set shadow pixels to 1 inside of a border around the shadow map area. In this example, fading the shadow out (or more technically, fading the light back in): https://jsfiddle.net/4675h9j8
    No more map edge artifact:
    Image
    (it doesn't need to be a fade, it could be a hard drop off around the edges, but I also wanted a configurable fade in my case).

Code

The problem becomes apparent (at least in this scnenario) with this particular line:

spotLight.shadow.focus = 0.3

Live example

above

Screenshots

above

Version

r182, macOS 26 Safari 26

Device

Desktop

Browser

Safari

OS

MacOS

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions