Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@kkolyan
Created May 6, 2020 01:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kkolyan/f1c603c1a8b935e81d580d4a4692d056 to your computer and use it in GitHub Desktop.
Save kkolyan/f1c603c1a8b935e81d580d4a4692d056 to your computer and use it in GitHub Desktop.
Shader "Unlit/Color Alpha Two-Sided" {
Properties {
_Color ("Main Color (A=Opacity)", Color) = (1,1,1,1)
_VTex ("Vertical Texture", 2D) = "white"
_HTex ("Horizontal Texture", 2D) = "white"
}
Category {
Tags {"Queue"="Transparent" "IgnoreProjector"="True"}
ZWrite Off
Blend SrcAlpha OneMinusSrcAlpha
SubShader {
CGINCLUDE
struct Input {
float2 uv_VTex;
float3 worldPos;
float3 worldNormal;
};
sampler2D _VTex;
sampler2D _HTex;
fixed4 _Color;
#pragma surface surf Lambert alpha noshadow finalcolor:color
void surf (Input IN, inout SurfaceOutput o) {
}
void color(Input IN, SurfaceOutput o, inout fixed4 color)
{
float3 norm = IN.worldNormal;
if (norm.y > 0 || norm.y < 0) {
color = tex2D (_HTex, IN.uv_VTex/*UV's of H and V area the same*/) * _Color;
} else {
color = tex2D (_VTex, IN.uv_VTex) * _Color;
}
}
ENDCG
Cull Front
CGPROGRAM
ENDCG
Cull Back
CGPROGRAM
ENDCG
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment