Hi again.
I asked a question previously [here][1], where @Fattie directed me to trying out lights to solve my problem. I didn't figure out how to do it, but I got really close to what I want using Projectors.
Basically I want to project a color in the shape of a circle, which will grow until it tints the entire environment.
This is what I have so far:
![alt text][2]
The problem is that I want them to override each other (in this case blue should override red) instead of blending their alpha channels.
Here is the shader I'm using for the projectors:
Shader "Custom/MyProjectorShader" {
Properties {
_Color ("Main Color", Color) = (1,1,1,1)
_ShadowTex ("Cookie", 2D) = "" { TexGen ObjectLinear }
_FalloffTex ("FallOff", 2D) = "white" { TexGen ObjectLinear }
}
Subshader {
Tags { "Queue" = "Overlay" }
Pass {
ZWrite Off
AlphaTest Greater 0
Offset -1, -1
ColorMask RGB
Blend SrcAlpha OneMinusSrcAlpha
// Color [_Color]
SetTexture [_ShadowTex] {
constantColor [_Color]
combine texture*constant
Matrix [_Projector]
}
SetTexture [_FalloffTex] {
constantColor (0,0,0,0)
combine previous lerp (texture) constant
Matrix [_ProjectorClip]
}
}
}
}
Their materials' Alpha is set to 200. If I set them to 255 this is the result:
![alt text][3]
I tried tinkering with the shader, but to no avail. I'm quite new to Shader programming. If someone could give me a hint, would me much appreciated. =)
Thanks.
[1]: http://answers.unity3d.com/questions/415519/how-do-i-tint-the-walls-and-floor-procedurally.html
[2]: /storage/temp/8886-projectors.png
[3]: /storage/temp/8887-projectors_no_blend.png
↧