Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 UltimateWalrus 1 · Feb 13, 2011 at 11:48 PM · graphicscallbackambient

Changing ambient light for just one object?

Hello,

I have sort of a survival-horror style game where the lighting is very dark. I have a monster who I would like to be visible through the darkness.

In DirectX or OpenGL, this would be trivial --- I'd just set the ambient light higher before the object is rendered, and set it back to where it was after it's been rendered.

Is there a way to do this in Unity? Are there some kind of prerender/postrender callback functions for a given object that I don't know about?

Thanks!

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

3 Replies

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

Answer by Eric5h5 · Feb 14, 2011 at 12:45 AM

Use a shader for the monster that adds some extra color value, similar to the built-in VertexLit shader's Emissive Color property.

Comment
Add comment · Show 1 · 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 UltimateWalrus 1 · Feb 14, 2011 at 03:15 AM 0
Share

Thanks for your help! I managed to do it using a shader which calculates the color based on (_Ambient + primary)*texture .

avatar image
2
Best Answer

Answer by Myth · Feb 14, 2011 at 01:28 AM

Put the monster on a different layer and have a separate light for the monster

(I think it is cull you change on the light)

Comment
Add comment · Show 2 · 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 UltimateWalrus 1 · Feb 14, 2011 at 03:16 AM 0
Share

This is a good idea as well, I'll keep this in $$anonymous$$d as I'll probably need to use this later in my game. Thanks!

avatar image UltimateWalrus 1 · Feb 14, 2011 at 03:18 AM 0
Share

In fact I may very well use this technique, as increasing ambient isn't giving me the exact effect I wanted.

avatar image
1

Answer by Jessy · Feb 14, 2011 at 01:52 AM

All the built-in shaders shaders that use lighting multiply the ambient light color by some other color. Despite what is said in the documentation, you're not restricted to 0-1; a Color is just four run-of-the-mill floats. If you need the ambient setting boosted, you can pick something that looks good using the color picker, in the Editor, and multiply all the channels of it by a constant greater than 1.

Unfortunately, as far as I know, the color for ambient and diffuse lighting is tied together in all of the built-in shaders, so I don't know that you can achieve this effect without deep modification. I had a look at some surface shader examples, and it didn't look easy, but I didn't look for very long. ;-)

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

No one has followed this question yet.

Related Questions

Illumination at runtime being weird. 1 Answer

Raytracing: Callback when Raytracing finished 0 Answers

Order of OnPostRender callbacks? 1 Answer

Android build not displaying correctly? (answered) 1 Answer

Blank screen on Android 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