Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Mesh shadows with point light appear as ANTI-shadows!

Discussion in 'Global Illumination' started by JoeStrout, Sep 13, 2016.

  1. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    It's the darndest thing. A picture can probably explain it better than words:



    I have a single light in the scene, a point light with a range of 100. That's a unit cube, which is casting a shadow just fine, and on top of it (with his foot slightly embedded in the cube) is my 2D character, a Skeleton Mesh with Mesh Renderer.

    Using a directional light, this character casts shadows just fine. But with the point light, instead of casting shadows, he casts anti-shadows... that is, its only effect is to disrupt shadows cast by other objects. You can see this in the image above; the cube shadow has a foot-shaped hole in it, and the platform's shadow has a cutout in the shape of the character as well.

    So... WTF? And is there anything I can do about it? (A directional light just doesn't work well for this scene.)
     
  2. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    Nobody?

    This is using the Spine shader, if that matters. Perhaps it's something unique to that... I'll go post on the Spine forum.
     
  3. Radiangames

    Radiangames

    Joined:
    Sep 15, 2011
    Posts:
    16
  4. uy3d

    uy3d

    Unity Technologies

    Joined:
    Aug 16, 2016
    Posts:
    187
    If your comfortable using renderdoc you may want to take a snapshot and inspect the pass that creates the shadowmap. One thing to look out for is that the skinned mesh and the unity primitive should use the same depth comparison when rendering into the shadowmap. Unity introduced inverse-z rendering at some point (defined as UNITY_REVERSED_Z in the shader files), so maybe the object's shadow pass doesn't properly handle that.