Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • 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
1
Question by AevinGames · Dec 11, 2016 at 11:24 PM · lighting3dcolordarkness

Objects is visible in dark... how to prevent that?

NO FORUM QUESTIONS HELPED!

I'm making a 3D game in unity, the only light source is bound to the player. When the platform is not in range of the light I can still see it... How do I fix this?

Basically hide red platform unless the player is near it....

Screenshots: alt text

alt text

b97522d6d86ad7b3360b89acff5fedc5.png (63.4 kB)
2876c2974979e39adc3c0c3376c9988b.png (7.6 kB)
Comment
Add comment · Show 2
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 Hanoble · Dec 12, 2016 at 12:52 AM 0
Share

Relying solely on lighting to prevent a player from seeing an object can be tricky. Depending on your game design, you may be able to just do a distance check between the player and the object and turn the renderer on only when the player is near the object.

avatar image Glurth · Dec 12, 2016 at 01:38 AM 0
Share

I would start by exa$$anonymous$$ing the platform's material. Is it different in anyway, other than color, from your objects that DO get hidden properly? For instance, perhaps you assigned it's material an unlit shader, or used the emission field in the standard-shader.

2 Replies

· Add your reply
  • Sort: 
avatar image
4
Best Answer

Answer by AlwaysSunny · Dec 11, 2016 at 11:24 PM

Looks like the scene's ambient light is causing this object to stand out from the surrounding grey objects. You can disable all ambient lighting to prevent this.

Anyone recommend another strategy, since that's probably not what the OP actually wants?

Comment
Add comment · Show 3 · 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
avatar image Bunny83 · Dec 12, 2016 at 01:30 AM 3
Share

I converted the comment into an answer as this is most likely the only solution.

Things like "black lights"(light that make things "darker") do not exist, neither in computer graphics nor in the real world. The so called black light is actually just ultraviolet light. It's a light spectrum that our human eye can't see. It's simply above the visible spectrum.

In computer graphics by default nothing has light unless you add one. In Unity however the ambient light (which is simply a light value that gets added to the endresult) is set to a dark grey. If you turn it down completely and remove all other light sources from the scene, the whole screen would be pitch black unless you use an unlit material. As long as the material uses the default lighting system it should be completely dark.

I don't see any problems with "relying solely on lighting to prevent a player from seeing an object". Turning the renderer on / off dynamically when the object can always be seen slightly when its renderer is on would just make the object pop-in / out suddenly. This is what you certainly don't want ^^.

avatar image Bunny83 · Dec 12, 2016 at 01:50 AM 1
Share

Btw: If you can't find the ambient light settings, go to Window -> Lighting. $$anonymous$$ake sure you don't use a skybox. Set the ambient source to "color" and edit the color to be completely black. Also change the "reflection source" to "custom". This should turn everything completely black as long as there is no light.

Here's the result of two default cubes which are on top of each other. I placed a single pointlight in front of the top cube. The "range" sphere slightly "touches" the edge of the bottom cube that's why you see a slight glow below but the rest of the cube can't be seen at all. Note that the cube is actually white.

edit
I just edited the image and copied 4 screen shots next to each other.

$$anonymous$$eep in $$anonymous$$d that you can use layers to make certain lights only affect certain objects. That way you can light the scene as you wish ^^.

avatar image UnityFan18 Bunny83 · Dec 23, 2016 at 02:30 AM 0
Share

Hi, I just wanted to thank you very much for this comment. It helped me tremendously because I was looking through various means to figure out how to make the scene completely dark and I wasn't finding anything. Thus, when I followed your instructions, I was able to get my scene completely dark. Thank you for your comment, I really appreciate it .

avatar image
0

Answer by RobAnthem · Dec 12, 2016 at 01:05 AM

I agree with @Hanoble, but I do have one idea. How about a Black light where the platform is, with a script the scales the light color based on distance from the player?

Comment
Add comment · 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.

Follow this Question

Answers Answers and Comments

10 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

Related Questions

Built game colors look way brighter/duller than in the editor 0 Answers

High definition RP And Lightweight Ruined my whole project textures 0 Answers

3d text color 2 Answers

How can i make the game area pitch black 2 Answers

Shader: get nearest point light's color, direction and general custom lighting questions 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