ADMIN-NOTE: Please move to Shader-Forum. Sorry for wrong category =/
Hey guys,
my game has a lot of lights on screen at the same time (traffic lights, to be specific) which can switch colors and therefor are dynamic. Until now I have used spotlights for that purpose, which beautifully illuminated the area in front of the light, drawing a nice little light cone. It worked fine on my PC, but testing it on my mobile device showed that most of the lights are being ignored.
So I thought about using projectors instead. I set one up following a blob-shadow tutorial. Naturally, the projected image looks like a colored shadow - instead I want it to appear like a light, brightening the area up instead of darkening it. I know that Unreal SDK provided projectors like that. Does Unity? You kind find the currently used shader code below.
Shader "FX/Projector Multiply" {
Properties {
_ShadowTex ("Cookie", 2D) = "fresnel.png" {
TexGen ObjectLinear
}
_FalloffTex ("FallOff", 2D) = "fresnel.png" {
TexGen ObjectLinear
}
}
Subshader {
Pass {
ZWrite off
Offset -1, -1
Fog { Color (1, 1, 1) }
AlphaTest Greater 0
ColorMask RGB
Blend DstColor Zero
SetTexture [_ShadowTex] {
combine texture, ONE - texture
Matrix [_Projector]
}
SetTexture [_FalloffTex] {
constantColor (1,1,1,0)
combine previous lerp (texture) constant
Matrix [_ProjectorClip]
}
}
}
}
Cheers