- Home /
Question by
jaybennett · Feb 09, 2015 at 11:52 AM ·
shadershader programmingshader writing
Updating a shader from Unity 3.3
Hi, I have a shader from a Unity project that was built for Unity 3.3. I'm looking for advice from a shader pro who might know where this shader is going wrong in Unity 4.5.
Shader "Fog Of War/Soft (Indie)" {
Properties {
_FadeTime ("Fade Time", float) = 1
_WorldTime ("World Time", float) = 0
_Color ("Fog Color", Color) = (1, 1, 1, 0.5)
}
SubShader {
Tags { "Queue"="Overlay-1" "RenderType"="Transparent" }
Cull Back
Lighting Off
Fog { Mode Off }
Pass {
ZWrite On
ZTest Always
ColorMask 0
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
float4 vert (appdata_base v) : SV_POSITION
{
return mul(UNITY_MATRIX_MVP, v.vertex);
}
half4 frag (float4 i) : COLOR
{
return 0;
}
ENDCG
}
Pass {
Blend DstColor Zero
ZWrite Off
ZTest Equal
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
float4 _Color;
float _FadeTime;
float _WorldTime;
struct output {
float4 pos : SV_POSITION;
half4 col : COLOR;
};
output vert (appdata_base v)
{
float t;
output o;
t = clamp(1 - ((_WorldTime - v.texcoord.x) / _FadeTime), v.texcoord.y, 1);
o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
o.col = t + (t * _Color * abs(1 - t));
return o;
}
half4 frag (output i) : COLOR
{
return i.col;
}
ENDCG
}
}
}
Comment
Your answer
Follow this Question
Related Questions
Where do I put this shader code? Getting weird error? 1 Answer
Shader Color 1 Answer
Addition to Standard Shader stopping it from batching? 0 Answers
Image effect shader not running 1 Answer
Shader Tiling Texture Overlapping between X and Z Axes 0 Answers