I have little expirience with shaders but I need to have a translucent object still cast a shadow,
any quick way to achieve this based on the transparant bumped diffuse shader?
Thanks
I have little expirience with shaders but I need to have a translucent object still cast a shadow,
any quick way to achieve this based on the transparant bumped diffuse shader?
Thanks
You can’t cast partial shadow, if that’s what you’re wondering. Objects can only block light or not.
If you want a transparent kind of realtime shadow, you can try fake it with a projector type setup, that should work for the most part, if you’re careful.
No its okay if its a full shadow, I have a somewhat translucent ice sphere, but its suposed to block light.
On a sidenote, the trees made in unity cast shadows based on their leafs so a alpha channel influencing shadows seems possible to me?
You can use the alpha channel for alpha testing to affect shadows, which is per-texel but still all-or-nothing. See the Transparent/Cutout family of shaders for examples.
A hacky way to get a semitransparent object to cast a semitransparent shadow is by duplicating your scene lights that you want to effect both your solid and semitransparent objects . Then by setting culling masks on those lights to exclude or include solid or semitransparent assets, you can selectively set the shadow strength on the lights that are exclusively for the semi transparent assets to say half or even less. Giving you solid shadows for lights which effect solid assets and semitransparent ones for objects that are not.
Not an ideal setup but it works.
Ok thats all above my head for now,
I just want the object that has this shader to cast (any kind of) shadow.
Shader "iceball" {
Properties {
_Color ("Main Color", Color) = (1,1,1,1)
_MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
_BumpMap ("Normalmap", 2D) = "bump" {}
}
SubShader {
Tags {"Queue"="Transparent+1" "IgnoreProjector"="True" "RenderType"="Transparent"}
LOD 300
CGPROGRAM
#pragma surface surf Lambert alpha
sampler2D _MainTex;
sampler2D _BumpMap;
float4 _Color;
struct Input {
float2 uv_MainTex;
float2 uv_BumpMap;
};
void surf (Input IN, inout SurfaceOutput o) {
half4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color;
o.Albedo = c.rgb;
o.Alpha = c.a;
o.Normal = UnpackNormal(tex2D(_BumpMap, IN.uv_BumpMap));
}
ENDCG
}
FallBack "Transparent/Diffuse"
}
I have been comparing this to a normal diffuse shader and tried changing some things with no results.