Hi ,
I am trying to use this blend shader in webGL build but its not working, It was working for android and iOS.
can anyone suggest what is the problem with this shader.
Shader "Blend 2 Textures, Simply Lit" {
Properties {
_Color ("Color", Color) = (1,1,1)
_Blend ("Blend", Range (0,1)) = 0.5
_MainTex ("Texture 1", 2D) = ""
_Texture2 ("Texture 2", 2D) = ""
}
Category {
Material {
Ambient[_Color]
Diffuse[_Color]
}
// iPhone 3GS and later
SubShader {
Pass {
Lighting On
ZWrite On
Cull Off
SetTexture[_MainTex]
SetTexture[_Texture2] {
ConstantColor (0,0,0, [_Blend])
Combine texture Lerp(constant) previous
}
SetTexture[_] {Combine previous * primary Double}
}
}
Fallback "Diffuse"
}
}
hey guys any idea what is the issue? or should i move this post to shader section of this forum?
Hi,
I found a solution in unity answers, This shader is working in webGL. Here is the link.
and here is the shader,
Shader "Custom/SimpleMix"
{
Properties
{
_MainTex ("Base (RGB)", 2D) = "white" {}
_BlendTex ("_BlendTex", 2D) = "white" {}
_Blend1 ("Blend between Base and Blend 1 textures", Range (0, 1) ) = 0
}
SubShader
{
//Disabled tags because they were cause some weird issue to unity UI to get invisible.
//Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
//LOD 200
ZWrite On
Cull Off
CGPROGRAM
#pragma surface surf Lambert
sampler2D _MainTex;
sampler2D _BlendTex;
float _Blend1;
struct Input
{
float2 uv_MainTex;
};
void surf (Input IN, inout SurfaceOutput o)
{
fixed4 mainCol = tex2D(_MainTex, IN.uv_MainTex);
fixed4 texTwoCol = tex2D(_BlendTex, IN.uv_MainTex);
fixed4 mainOutput = mainCol.rgba * (1.0 - (texTwoCol.a * _Blend1));
fixed4 blendOutput = texTwoCol.rgba * texTwoCol.a * _Blend1;
o.Albedo = mainOutput.rgb + blendOutput.rgb;
o.Alpha = mainOutput.a + blendOutput.a;
}
ENDCG
}
FallBack "Diffuse"
}