Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question The buggy result of a AlphaTest (with shadow) Shader

Discussion in 'Shaders' started by NMotome, Apr 27, 2021.

  1. NMotome

    NMotome

    Joined:
    Feb 20, 2020
    Posts:
    7
    Hey there,

    I downloaded model and textures from DOTA2 and wrote a shader for it. Everything goes right except for the shadow.

    I learned that if I want to add shadow in an AlphaTest shader, I will need to add a "_Cutoff " and a "_Color" property, and set the FallBack to "Legacy Shaders/Transparent/Cutout/VertexLit".

    I did that. However something wired just happend. Actually I don't know how to describe that properly...

    Here are some clues:
    1. The shadow will disappear when I push down the mouse button (like drag and rotate)
    2. The shadow reappears after I release the button for a while. And I can see some noise if I take a closer look.
    3. I can see the model (just a contour) behind it if I hold down the mouse button, just like being some what transparent.
    4. The model become opaque again when I release the button.
    5. If the "_Cutoff " property is commented, ALL of the above will GONE.

    I'm just going to go mad about this stuff... I have an another shader from internet that goes well with AlphaTest & shadow & _Cutoff, but I just don't know what made all these happened...

    Help, and thanks. QWQ
     
    Last edited: Apr 27, 2021
  2. NMotome

    NMotome

    Joined:
    Feb 20, 2020
    Posts:
    7
    I upload a video on YouTube.
    If someone curious about what happened on earth, go have a look...