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

Toon Shader Shadow Bleeding

Discussion in 'Shaders' started by Parappa2, Jul 23, 2017.

  1. Parappa2

    Parappa2

    Joined:
    Sep 9, 2016
    Posts:
    12
    Last edited: Jul 23, 2017
  2. Parappa2

    Parappa2

    Joined:
    Sep 9, 2016
    Posts:
    12
  3. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,329
    The way Unity's shadows work there's not a good work around for this. The problem is any shader that allows lighting to affect surfaces facing away from the light will start to show the "raw" shadow. Usually this is hidden as the lighting for that light is already "off" on those surfaces.

    I believe the Unity Chan shaders avoid the problem by not supporting shadow receiving of any kind, self shadowing or otherwise.

    A plausible work around would be to use a custom shadow caster pass that casts shadows from back faces, but this is made more complicated to implement by the fact that Unity reuses the shadow caster for shadow receiving too.
     
  4. Parappa2

    Parappa2

    Joined:
    Sep 9, 2016
    Posts:
    12
    It does receives shadows and casts self shadows and it works great.
    a toon shader that receives shadows and casts self shadows was specifically what i was looking for
     
  5. Detonator_Pao_

    Detonator_Pao_

    Joined:
    Jun 7, 2017
    Posts:
    2
    I also found the problem about Unity chan shaders.
    When import Unity chan to the project. When open a new scene and drag a environment prefabs (e.g. reusable room) in to the scene. Everything in the scene don't have shadow at all. Including any 3D object that newly created on the scene also got this effect.

    So, beware of using her (I means Unity chan) in project.