Hello everyone,
Am trying to make a fading effects with many styles (top-down, in-out, and vice versa)
and i think that the best way to do that is to have an alpha mask applied to the two textures that am gonna fade between, the alpha mask should be a gradient black and white image where white give 1.0 alpha and black give 0.0 (in respect of the value between)
so by drawing different gradient texture i will have different fading effects,
the question is :
is it possible to have that gradient texture applied to some material, so the main texture of that material will have different alpha values ??
thank you
creating a custom shader with this code solved the problem :
Shader "Custom/ShaderTest"
{
Properties {
_Color ("Main Color", Color) = (1,1,1,1)
_MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
_AlphaMap ("Additional Alpha Map (Greyscale)", 2D) = "white" {}
}
SubShader {
Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
LOD 200
CGPROGRAM
#pragma surface surf Lambert alpha
sampler2D _MainTex;
sampler2D _AlphaMap;
float4 _Color;
struct Input {
float2 uv_MainTex;
};
void surf (Input IN, inout SurfaceOutput o) {
half4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color;
o.Albedo = c.rgb;
o.Alpha = c.a * tex2D(_AlphaMap, IN.uv_MainTex).r;
}
ENDCG
}
Fallback "Transparent/VertexLit"
}
Is there a way to do this same thing but with an unlit sprite shader instead of a surface??
Thanks!