Particles not rendering over projectors
15. Září 2016 v 12:54
I am using projectors for shadows...When I use particles for bike speed up i.e., nitro speed the particles get cutout by those shadows....
Here is screenshot of it,
Here is my shader code of projectors ,
Shader "Projector/Projector Multiply Black"
{
Properties
{
_ShadowTex("Cookie", 2D) = "gray" { TexGen ObjectLinear }
_ShadowStrength("Strength",float) = 1
}
Subshader
{
Tags{ "RenderType" = "Transparent" "Queue" = "Transparent+100" }
Pass
{
ZWrite Off
//Fog { Mode Off }
Blend DstColor Zero
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma fragmentoption ARB_fog_exp2
#pragma fragmentoption ARB_precision_hint_fastest
#include "UnityCG.cginc"
struct v2f
{
float4 pos : SV_POSITION;
float2 uv_Main : TEXCOORD0;
};
sampler2D _ShadowTex;
float4x4 unity_Projector;
float _ShadowStrength;
v2f vert(appdata_tan v)
{
v2f o;
o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
o.uv_Main = mul(unity_Projector, v.vertex).xy;
return o;
}
half4 frag(v2f i) : COLOR
{
half4 tex = tex2D(_ShadowTex, i.uv_Main);
half strength = (1 - tex.a*_ShadowStrength);
tex = (strength,strength,strength,strength);
return tex;
}
ENDCG
}
}
}
Here is my particle code,
// Simple additive particle shader.
Shader "Custom/Particle additive"
{
Properties
{
_MainTexture ("Particle Texture (Alpha8)", 2D) = "white" {}
}
Category
{
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
Blend SrcAlpha One
Cull Off Lighting Off ZWrite Off Fog {Color (0,0,0,0)}
BindChannels
{
Bind "Color", color
Bind "Vertex", vertex
Bind "TexCoord", texcoord
}
SubShader
{
Pass
{
SetTexture [_MainTexture]
{
combine primary, texture * primary
}
}
}
}
}