Hi,
i’m new to Unity and shaders, and I tried really a lot of things to modify/create a shader for my needs.
I’m trying to make a “page shine through effect”, that means I have an image/texture where I need to add some white on top (I really don’t know how to explain it), to get it looking less strong. Now I used a second white texture with alpha 0.9 or something to just let 10% of the main textures colors “shine through”.
I got that working so far, but I need to fade this “page” in and out, that means I need to add an alpha/transparency for the whole thing.
Here is what I came up with until now, any help/suggestions are highly appreciated!
Thx in advance!
Shader "PageFlip/Page3"
{
Properties
{
_Color ("Main Color", Color) = (1,1,1,1)
_MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
_BlendTex ("Blend (RGB)", 2D) = "white"
}
SubShader
{
Tags { "Queue"="Geometry-9" "IgnoreProjector"="True" "RenderType"="Transparent" }
Lighting Off
ZTest GEqual
LOD 200
//Blend SrcAlpha OneMinusSrcAlpha
CGPROGRAM
#pragma surface surf Lambert
// add "alpha" to pragma to turn on alpha
sampler2D _MainTex;
fixed4 _Color;
struct Input {
float2 uv_MainTex;
};
void surf (Input IN, inout SurfaceOutput o) {
fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color;
o.Albedo = c.rgb;
o.Alpha = c.a;
}
ENDCG
Pass {
SetTexture [_MainTex]
SetTexture [_BlendTex] {
constantColor (0, 0, 0, 0.9) // last value is blend opacity
combine texture lerp (constant) previous
}
}
}
Fallback "Transparent/VertexLit"
}