Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Shader "Custom/ColorWithMask" {
- Properties {
- _Color ("Color", Color) = (1,1,1,1)
- _MainTex ("Albedo (RGB)", 2D) = "white" {}
- _MaskTex("Mask For Color", 2D) = "white" {}
- }
- SubShader {
- Tags { "RenderType"="Opaque" }
- LOD 200
- CGPROGRAM
- #pragma surface surf Lambert
- sampler2D _MainTex;
- sampler2D _MaskTex;
- struct Input {
- float2 uv_MainTex;
- };
- fixed4 _Color;
- void surf (Input IN, inout SurfaceOutput o) {
- // Albedo comes from a texture tinted by color
- fixed4 c = tex2D(_MainTex, IN.uv_MainTex);
- fixed4 m = tex2D(_MaskTex, IN.uv_MainTex);
- c *= lerp(1, _Color, m.r);
- o.Albedo = c.rgb;
- o.Alpha = c.a;
- }
- ENDCG
- }
- FallBack "Diffuse"
- }
Add Comment
Please, Sign In to add comment