Hi,
May i know is there any shader that doing things like blend 2 texture together but showing blending of Texture A to Texture B in 1 rectangle?
It means like I still can see Texture A at top of the Rect but It slowly transit into Texture B at the bottom of Rect.
Thanks for Reading.
The way you describe this feature sounds like a type of image transition, like between two scenes in a movie or two slides in a powerpoint presentation? If this is correctly understood, I’m sorry to say there is no single shader right out of the box that does that in Unity. Try searching in the asset store, or try to combine the movement of different objects with individual shaders to achieve the effect. If you feel up to the task, you could also try to write the shader yourself.
I finally managed to get what i want by using the shader as below:
Shader "Custom/2TextureBlend"
{
Properties
{
_tex0 ("Texture1", 2D) = "white" {}
_tex1 ("Texture2", 2D) = "white" {}
}
SubShader
{
Tags {Queue = Geometry}
ZWrite Off
Lighting Off
Pass
{
CGPROGRAM
#pragma target 2.0
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
sampler2D _tex0;
sampler2D _tex1;
struct v2f
{
float4 pos : POSITION;
float4 color : COLOR0;
float4 fragPos : COLOR1;
float2 uv : TEXCOORD0;
};
float4 _tex0_ST;
v2f vert (appdata_base v)
{
v2f o;
o.pos = mul (UNITY_MATRIX_MVP, v.vertex);
o.fragPos = o.pos;
o.uv = TRANSFORM_TEX (v.texcoord, _tex0);
o.color = float4 (1.0, 1.0, 1.0, 1);
return o;
}
half4 frag (v2f i) : COLOR
{
float2 q = i.uv.xy / float2(1,1);
float3 oricol = tex2D (_tex0,float2(q.x,q.y)).xyz;
float3 col = tex2D (_tex1,float2(i.uv.x,i.uv.y)).xyz;
float comp = smoothstep( 0.2, 0.7, sin(0.5) );
col = lerp(col,oricol, clamp(-2.0+2.0*q.y+3.0*comp,0.0,1.0));
return float4(col,1);
}
ENDCG
}
}
FallBack "VertexLit"
}