Unity Share for Particles/Anims

Polycount Sponsor
Offline / Send Message
Noth Polycount Sponsor
Hey guys, I have this shader I've been working with in Unity. I'm not a programmer, but it's been doing the trick. One thing I dislike about it is that it overrides the 'Colour over lifetime' modifier in unity, which I would really like back. I need the animated Uv stuff this has on it though. I'd rather plug in b/w textures and change the colour in Unity. Here is the shader if theres any ninjas out there that could help me out. I would also be more than happy to find another magic shader that did the Uv stuff, colour over lifetime and maybe some other cool things? *crosses fingers!



Shader "Games Foundry/GFShader_DiffuseAlphaUVAnimator"
{

Properties
{
_MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
_Emission ( "Emission", Range(0.0, 1.0) ) = 0
_Tint ("Tint Color", Color) = (1,1,1,1)
_EmissionFade ("Emission Fade", Range (0.0,1.0)) = 0.5
_AnimSpeed ("Animation Speed", Float) = 1.0
_MainFlowRateU ("UV Scroll Rate U", Float) = -1.0
_MainFlowRateV ("UV Scroll Rate V", Float) = 1.0
_Alpha ("Alpha", Range (0.0,1.0)) = 0.8
}

SubShader
{
Tags {"Queue"="Transparent+5" "IgnoreProjector"="True" "RenderType"="Transparent"}
ZWrite On



Blend SrcAlpha OneMinusSrcAlpha

Fog { Mode Off }
//Blend One One

CGPROGRAM
#pragma surface surf Lambert alpha vertex:vert

struct Input {
half2 uv_MainTex;
float4 vertexColor;
};
void vert ( inout appdata_full v, out Input o )
{
UNITY_INITIALIZE_OUTPUT(Input,o);
o.vertexColor = v.color;
}


sampler2D _MainTex;

float _EmissionFade;
float _AnimSpeed;
float _Alpha;
fixed4 _Color;
fixed4 _Tint;
float _Emission;

float _MainFlowRateU;
float _MainFlowRateV;
float _BumpFlowRate;
float _EmissionFlowRate;

void surf (Input IN, inout SurfaceOutput o)
{


half2 uvsMain = IN.uv_MainTex;
uvsMain.x += _Time * _AnimSpeed * _MainFlowRateU;
uvsMain.y += _Time * _AnimSpeed * _MainFlowRateV;
//uvsMain.x -= _Time * _AnimSpeed * 0.2;


o.Albedo = tex2D (_MainTex, uvsMain).rgb* ( 1.0 - ( ( 1.0 - IN.vertexColor.r ) * 0.5 ) );
// Add in tint
o.Albedo = lerp ( o.Albedo, o.Albedo * _Tint.rgb, 0.5 * ( ( 1.0 - IN.vertexColor.r ) * 0.5 ) );

o.Alpha = tex2D (_MainTex,uvsMain).a *( 1.0 - ( ( 1.0 - IN.vertexColor.a ) * 1 ) );

o.Alpha *= _Alpha;
//o.Alpha = lerp ( o.Albedo, o.Albedo * _Tint.a, 0.5 * ( ( 1.0 - IN.vertexColor.r ) * 0.5 ) );

//o.Albedo = tex2D (_MainTex, uvsMain).rgb;
//o.Alpha = tex2D (_MainTex,uvsMain).a;
o.Emission = tex2D (_MainTex, uvsMain).rgb * _Emission;

}
ENDCG
}

//Fallback "Transparent/VertexLit"
Fallback "Alpha/VertexLit", 1
}

Replies

Sign In or Register to comment.