• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
Question by oliver-jones · Oct 03, 2013 at 12:26 PM · gui3dlightingscene

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]
 }}
  
 }
Comment

People who like this

0 Show 4
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image KiraSensei · Oct 03, 2013 at 03:05 PM 0
Share

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 :)

avatar image oliver-jones · Oct 03, 2013 at 03:22 PM 0
Share

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

avatar image robertbu · Oct 03, 2013 at 03:31 PM 1
Share

If the problem is solved, please close the question.

avatar image oliver-jones · Oct 03, 2013 at 03:38 PM 0
Share

Could you do me a favour and convert your comment to an answer so I can mark it correct. Thanks.

1 Reply

· Add your reply
  • Sort: 
avatar image
Best Answer

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.

Comment
oliver-jones
DylanW

People who like this

2 Show 0 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

15 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

What does GI stand for? 1 Answer

Everything in my scene turns black when I switch to skybox lighting, how do I fix this? 1 Answer

Can I disable loading of lights maps in runtime? 1 Answer

How to optimize lights in Unity? 0 Answers

Gui label text change 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges