Search Unity

Question Achieving pixel perfect shadows by clipping Shadows in Surface Shader

Discussion in 'Shaders' started by SomeHumbleOnion, May 10, 2021.

  1. SomeHumbleOnion

    SomeHumbleOnion

    Joined:
    Jan 18, 2021
    Posts:
    28
    Hello Shader Forum! Apologies in advance for my noobness at Shaders as I'm still quite new to writing them.

    I've been studying Shaders thanks to Ronja's Tutorials and I've been messing around with her Single Step Toon Shader but I'm having trouble making the shadows crispier. The 3D game I'm working on has a pixelated effect (achieved using the Pixel Perfect Camera Component), so blurry shadows look really bad and out of place and I'm trying to crunch them up (see screenshot image). FYI my Directional Light does have shadows set to hard in the screenshot.

    I saw this post on Twitter about how you can achieve crunchier, cartoony shadows by clipping the shadows at 0.5 within your surface shader but I'm not sure how to go about that. From what I've found, the clip() function gets rid of pixels less than the specified value so it sounds like I need to use it to get rid of the excess aliased pixels from these shadows.

    Is trying to add a clip() function in Ronja's Toon Shader the right step I need to take to achieve pixel perfect shadows? If so, how would I go about adding this? Any help is greatly appreciated!
     

    Attached Files:

    • s1.PNG
      s1.PNG
      File size:
      8 KB
      Views:
      301