Adobe Flash Tint, ColorTransform

Hey,

I’m trying to get the same “Tint” effect from Adobe Flash where I can choose a color and a % to apply on my material. I also want to keep the alpha.

I currently use the Transparent Vertex Colored Shader from SM2, and I’m a complete newbie on Shader.
If I put green for the Main Color, I get this instead of the 100% tint of Flash (above):

So how could I get the result above instead ?

Thanks !

Sounds like you want to lerp to the main colour instead of tinting it.

Shader "Mobile/Transparent/Vertex Color Main Lerp" {
Properties {
	_Color ("Main Color", Color) = (1,1,1,1)
	_SpecColor ("Spec Color", Color) = (1,1,1,0)
	_Emission ("Emmisive Color", Color) = (0,0,0,0)
	_Shininess ("Shininess", Range (0.1, 1)) = 0.7
	_MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
}

Category {
	Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
	ZWrite Off
	Alphatest Greater 0
	Blend SrcAlpha OneMinusSrcAlpha 
	SubShader {
		Material {
			Diffuse [_Color]
			Ambient [_Color]
			Shininess [_Shininess]
			Specular [_SpecColor]
			Emission [_Emission]	
		}
		Pass {
			ColorMaterial AmbientAndDiffuse
			Fog { Mode Off }
			Lighting Off
			SeparateSpecular On
			SetTexture [_MainTex] {
				Combine texture * primary
			}
			SetTexture [_MainTex] {
				constantColor [_Color]
				Combine constant lerp(constant) previous DOUBLE, previous
			}  
		}
	} 
}
}

Almost there ! When I use Lerp, the transparent pixel get to the main color as well, so I get a red square and lose the transparency.

I need to somehow get the alpha channel of a color, and lerp the tint via another alpha channel…

Are you using the shader I posted? It works as expected for me. Have you perhaps forgotten “, previous” at the end of the lerp combiner?

When I use the shader you posted, I lose the alpha channel (because it’s used on the lerp). I need to another alpha color to add on top of this that would simply multiply only the alpha channel on the result above.

Either I’m missing something, or you aren’t using the shader I posted. The image alpha channel is not used in the lerp, and even if it were, it wouldn’t be “lost”.

Combine constant lerp(constant) previous DOUBLE, previous

The “previous” after the comma means that the alpha channel from the previous operation is used. The lerp operation uses the alpha channel of the _Color property to determine its final colour contribution.