Quantcast
Channel: Answers for "Applying a Color to a Texture's Alpha Channel"
Viewing all articles
Browse latest Browse all 6

Answer by TeddyDief

$
0
0
I got it working in ShaderLab, everyone! Thank you for your help!! This Shader colors the material with _AlphaColor only where the texture is set to the alpha channel as a mask. It will appear identical to the Unity Mobile VertexLit built-in shader, but with this coloring effect. Here's the code, for anyone who wants it! Shader "Custom/VertexLitAlphaColoring" { Properties { _AlphaColor ("Alpha Color", Color) = (1,1,1,1) _MainTex ("Base (RGB)", 2D) = "white" {} } SubShader { Tags { "RenderType"="Opaque" } LOD 80 Pass { Tags { "LightMode" = "Vertex" } // Setup Basic Material { Diffuse (1,1,1,1) Ambient (1,1,1,1) } Lighting On // Lerp between AlphaColor and the basic vertex lighting color SetTexture [_MainTex] { constantColor [_AlphaColor] combine previous lerp(texture) constant DOUBLE, previous lerp(texture) constant } // Multiply in texture SetTexture [_MainTex] { combine texture * previous } } } }

Viewing all articles
Browse latest Browse all 6

Latest Images

Trending Articles





Latest Images