- Home /
Plane Object as GUI - Lighting Issue
Hello,
I'm using planes and quads for backgrounds to my GUI panels within my actual scene. Because of this, the object is taking on lighting behaviours, which I do not want.
Is there away to tell the game object/shader to completely ignore lighting? Because right now, I'm using a directional lightly specifically for my GUIs, which I do not want.
I want to be able to use the absolute colour I have defined in the material shader.
If it helps, I have this shader that allows you to apply an absolute textures to a game object that doesn't take on any lighting (used for GUI too):
Shader "GUI/Texture Only" {
Properties {
_Color ("Main Color", Color) = (.5,.5,.5,1)
_MainTex ("Texture", 2D) = ""
}
SubShader {Pass { // iPhone 3GS and later
GLSLPROGRAM
varying mediump vec2 uv;
#ifdef VERTEX
void main() {
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
uv = gl_MultiTexCoord0.xy;
}
#endif
#ifdef FRAGMENT
uniform lowp sampler2D _MainTex;
void main() {
gl_FragColor = texture2D(_MainTex, uv);
}
#endif
ENDGLSL
}}
SubShader {Pass { // pre-3GS devices, including the September 2009 8GB iPod touch
SetTexture[_MainTex]
}}
}
Personnally, for a 3D game, I use a second camera to handle GUI textures, rendered after the first one. So the second camera (and the GUI planes, objects...) does not move at all, so no problems with lights :)
That's what I am doing - I have one camera to render only my GUIs, and another to render everything else. Even with this, the game objects that are being used as GUIs still react to light. I've changed them to the Unlit shader, and it seems to look just fine. Thanks
Could you do me a favour and convert your comment to an answer so I can mark it correct. Thanks.
Answer by robertbu · Oct 03, 2013 at 02:50 PM
There are lots of shaders that don't take on lighting. Try Unlit/Texture for example. And there are many more including ones on the Wiki.