So I’m not much of a Shader guy. I do most of my shaders in Strumpy shader editor because of this.
I’ve read through many posts and documents from unity on the subject. I can’t seem to figure out how to add shadow casting to this shader.
So far it is a perfect shader for doing hair. I would love a specular control map, but even as it is, it is great. The only problem is it doesn’t cast shadows!
I would appreciate any help.
Shader “Transparent/Hair” {
Properties {
_Color (“Main Color”, Color) = (1,1,1,0.8)
_SpecColor (“Spec Color”, Color) = (1,1,1,0)
_Emission (“Emmisive Color”, Color) = (0,0,0,0)
_Shininess (“Shininess”, Range (0.1, 1)) = 0.7
_MainTex (“Base (RGB) Alpha (Animation)”, 2D) = “white” {}
_SpecMap (“SpecularMap”, 2D) = “white” {}
_BumpMap (“Bumpmap”, 2D) = “bump” {}
_Cutoff (“Alpha cutoff”, Range (0.01,.98)) = .85
}
Category {
Tags {Queue=Transparent }
ColorMask RGB
Material {
Diffuse [_Color]
Ambient [_Color]
Shininess [_Shininess]
Specular [_SpecColor]
Emission [_Emission]
}
Lighting On
SeparateSpecular On
Cull OFF
SubShader {
Pass {
ZWrite On
Alphatest Greater [_Cutoff]
SetTexture [_MainTex] {
Combine texture * primary DOUBLE, texture
}
SetTexture [_SpecMap] {
combine previous * texture
}
}
Pass {
ZWrite Off
Alphatest LEqual [_Cutoff]
Blend SrcAlpha OneMinusSrcAlpha
SetTexture [_MainTex] {
Combine texture * primary DOUBLE, texture
}
}
}
}
}
Try adding…
Fallback “VertexLit”
…just before the very last }
Wow.
That was so easy I feel like a total fool for having to ask. Thank you Farfarer.
I need to learn more about shader coding.
Cheers!
No worries, took me ages to find that one little line that makes shadows work when I first started messing with shaders
Really cool concept art for your project, btw - digging the style
Thanks, should have some models and more concept art in a few weeks once I get my shaders up and running!
Cheers again for the help.