I’m having a real headache trying to get a shader to adopt no lighting and additive blending. This is what I have after hours of trial and error:
Shader "Animated/Trans Unlit" {
Properties {
_MainTex ("Base (RGB)", 2D) = "black" {}
_XMul ("UV.x mul", Float) = 0.25
_YMul ("UV.y mul", Float) = 0.25
_Offsets ("_Offsets from script", Vector) = (0,0,0.25,0.25)
_Blend ("blend factor between frames", Range(0,1)) = 0
}
SubShader
{
Tags
{
"RenderType"="Transparent"
"Queue"="Transparent-1"
}
ZWrite Off
Cull Off
Lighting Off
Blend One One
CGPROGRAM
#pragma surface surf Lambert alpha
sampler2D _MainTex;
float4 _Offsets;
float _XMul;
float _YMul;
float _Blend;
struct Input {
float2 uv_MainTex;
};
void surf (Input IN, inout SurfaceOutput o)
{
float2 uv = IN.uv_MainTex * float2(_XMul, _YMul);
uv += float2(_Offsets.x, _Offsets.y);
half4 c1 = tex2D (_MainTex, uv);
uv = IN.uv_MainTex * float2(_XMul, _YMul);
uv += float2(_Offsets.z, _Offsets.w);
half4 c2 = tex2D (_MainTex, uv);
o.Albedo = lerp(c1.rgb, c2.rgb, _Blend);
o.Alpha = lerp(c1.a, c2.a, _Blend);
}
ENDCG
}
FallBack "Particles/Additive"
}
I’ve tried moving the Lighting and Blend settings into different Pass blocks and Category blocks, and outside of pass blocks. I’ve tried several variations and mixtures of different locations for these settings, and they all come up the same. They all look like this:
As you can see, the ZWriting and Culling are turned off, and there is some kind of blending, but it’s not Additive. It’s also not unlit.
I can turn ZWriting and Culling on or off successfully, but Lighting seems to stay on no matter what, and Blending is acting plain weird. The results are exactly the same in-game.
Anyone have any idea what’s causing this strange behaviour?