Multiply Mode uses strange Alpha

(Link to code:

Hey Everyone -

I’m writing my own multi-pass shader for handling several effects at once. This is for a sprite-based game.

This shader has three textures: one for the base colors, one for highlights (using additive mode), and one for interior shadows (using multiply mode). It also has four other settings: an overall opacity (slider), main Tint color, highlight color, and shadow color (all RGBA). These colors have an alpha value to give direct control over the intensity of the highlights and shadows.

Here’s how it appears in Unity’s GUI:

Everything works great, except for the multiply mode when I use “Blend Zero SrcColor.”

Here’s an image showing the results with various settings (yes, that’s Saki from Arcana Heart, which I’m only using for test purposes):

1 - Opacity set to 0, Tint Highlight and Shadow set to Alpha 0.

2 - Same as #1, Opacity set to 1.0

3 - Same as #1, Highlight set to Alpha 1.0 (you can see the alpha in the actual texture map coming through)

4 - Same as #1, Shadow set to Alpha 1.0, using standard blending (“Blend SrcAlpha OneMinusSrcAlpha”)

5 - Same as #1, Shadow set to Alpha 1.0, using multiply blending (“Blend Zero SrcColor”)

As you can see, the alpha on the multiply texture becomes fragmented when I use Blend Zero SrcColor, oddly enough. Any ideas on how I can handle this issue?

Thanks for your time and insight!

Did it!

    // Based on Particles/VertexLit Blended
    Shader "Custom/VertexLit Blended w Add and Mult" {
	Properties {
		// _EmisColor ("Emissive Color", Color) = (.2,.2,.2,0)
		_Opacity ("Object Opacity", Range(0.0, 1.0) ) = 1.0
		_MainTex ("Main Diffuse", 2D) = "white" {}		
		_AddTex ("Hilight Texture", 2D) = "white" {}
		_MultTex ("Shadow Texture", 2D) = "white" {}
		_TintColor ( "Main Tint Color", Color) = (.5, .5, .5, 0)
		_AddColor ( "Hilight Tint Color", Color) = (0,0,0,0)
		_MultColor ( "Shadow Color", Color) = (1, 1, 1, 0.0)

	SubShader {
		// Preps and Setup
		Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
		Tags { "LightMode" = "Vertex" }
		Cull Off
		Lighting On
		Material { } //Emission [_EmisColor] }
		ColorMaterial AmbientAndDiffuse
		ZWrite Off
		ColorMask RGB
		AlphaTest Greater .001
		Blend SrcAlpha OneMinusSrcAlpha
		Pass {
			// Set Tint Color and apply main texture's alpha to it.
			SetTexture [_MainTex]{
				constantColor [_TintColor]
				combine constant lerp (constant) texture
			// Apply main texture with the Opacity setting included
			SetTexture [_MainTex]{
				combine previous, texture * constant
			// Apply lighting
			SetTexture [_MainTex]{
				combine primary * previous
		Blend SrcAlpha One
		Pass {
			// Apply the Highlights, using the opacity in AddTex.
			SetTexture [_AddTex]{
				ConstantColor [_AddColor]
				combine constant, texture * constant
			SetTexture [_AddTex] {
				combine previous, previous * constant
		Blend DstColor Zero
		Pass {
			SetTexture[_MainTex] {
				combine texture, constant
			SetTexture[_MultTex] {
				combine previous, previous * texture
			SetTexture[_MultTex] {
				combine one-previous alpha + constant