I’m a total novice when it comes to writing shaders, and I’m trying to figure out a solution for something that I’d expect to be pretty simple. I’m hoping someone can point me in the right direction.
For most of my iPhone projects, I use this simple shader I grabbed from the Unify wiki ages ago. It’s a simple self-illuminated alpha blended shader that is perfect for faux-2d graphics and GUI elements.
Shader "My Shaders/AlphaSelfIllum" {
Properties {
_Color ("Color Tint", Color) = (1,1,1,1)
_MainTex ("SelfIllum Color (RGB) Alpha (A)", 2D) = "white"
}
Category {
Lighting On
ZWrite Off
Cull Back
Blend SrcAlpha OneMinusSrcAlpha
Tags {Queue=Transparent}
SubShader {
Material {
Emission [_Color]
}
Pass {
SetTexture [_MainTex] {
Combine Texture * Primary, Texture * Primary
}
}
}
}
}
The only thing I’d like to be able to do differently with this shader is use the “Color Tint” to “over-expose” the base texture. With the version above, the default for the Color Tint is pure white, and cranking it down to grey or black will darken and eventually completely blacken the image. How would I go about doing the opposite, where I have black (or even 50% grey) be the baseline? The goal is to be able to make elements in my scene “flash” procedurally by brightening the color in the material at runtime.