Search Unity

How To: Hi Poly Object with a low Poly Shadow

Discussion in 'Shaders' started by horst27b, Oct 10, 2009.

  1. horst27b

    horst27b

    Joined:
    Mar 9, 2009
    Posts:
    30
    Hi,

    i need a shader that only cast a shadow. I found some keywords, but didn't find any documentation.

    This is what i found, to only display the shadow of an object.
    Code (csharp):
    1.  
    2. Shader "TreeShader"
    3. {
    4.    SubShader
    5.    {  
    6.       UsePass "VertexLit/SHADOWCASTER"
    7.    }
    8. }
    9.  
    But this is not working on transparent textures like trees.

    Also i found some thing about ShadowCaster - but how it works?
     
  2. Daniel_Brauer

    Daniel_Brauer

    Unity Technologies

    Joined:
    Aug 11, 2006
    Posts:
    3,355
    Perhaps try "Transparent/Cutout/VertexLit/Caster". You'll need to provide a _Cutoff property so the pass can use it.
     
  3. horst27b

    horst27b

    Joined:
    Mar 9, 2009
    Posts:
    30
    i tryed it, but i doesnt work.

    Unity Editor says: "Shader 'TreeShader': no subshader can run on this graphics card"

    This is my shader:

    Code (csharp):
    1.  
    2. Shader "TreeShader"
    3. {
    4.     Properties {
    5.         _Color ("Main Color", Color) = (1,1,1,1)
    6.         _Cutoff ("Base Alpha cutoff", Range (0,.9)) = .9    
    7.         _MainTex ("Base (RGB)", 2D) = "white" {}
    8.     }
    9.    
    10.    SubShader
    11.    {  
    12.       UsePass "Transparent/Cutout/VertexLit/Caster"
    13.    }
    14. }
    15.  
     
  4. Daniel_Brauer

    Daniel_Brauer

    Unity Technologies

    Joined:
    Aug 11, 2006
    Posts:
    3,355
    I ran into the same problem once, and I fixed it by copying the entire pass to the shader instead of using UsePass. I have no idea why that would work, but it did.
     
  5. horst27b

    horst27b

    Joined:
    Mar 9, 2009
    Posts:
    30
    Thanks, this make sense. But where i can find the original shaders in unity3d? I can't find the shaders in the directory's.
     
  6. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Look at the stickies for the forum that this topic is in.

    --Eric