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
0
Question by Fainzeraier · Aug 20, 2017 at 12:13 PM · lightinglight

Negative light no longer possible?

It used to be possible to make light with negative color values using a script, e.g. GetComponent<Light>().color = new Color(-1, -1, -1, 1)

I used it with a cookie texture for fog of war like this http://i.imgur.com/fFgWpFX.jpg. It worked in Unity 5.5 or 5.6, but after updating to 2017.1.0f3 it doesn't seem to be work at all (the negative colored light doesn't have any effect on the surroundings).

So, anyone know if this feature has been removed, or can be achieved in a different way?

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

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by tanoshimi · Aug 20, 2017 at 12:52 PM

I'm surprised that ever worked but, if it did, it was undefined behaviour so has possibly been fixed in some release. Colors are defined by three floating point values between 0-1, as documented at https://docs.unity3d.com/ScriptReference/Color.html

How can a color have a negative red component? The standard blending modes regarding additive or multiplicative light would behave very oddly, and it certainly makes no sense in a PBR context. I'm unclear what you're trying to achieve - if you want to make part of your level dark, just don't light it in the first place?

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
avatar image
0

Answer by Fainzeraier · Aug 20, 2017 at 02:12 PM

It did behave kinda oddly with some colors, but had a couple of very useful applications since it could alter colors without increasing total brightness.

The color (-1,-1,-1,1) could be used to make the area around the light darker, which could be used for black magic effects, for example. Taking a color and subtracting 1 from each component would make that color more prominent, e.g. red with each component reduced by 1 made the surroundings much redder (spotlight with a cookie: http://i.imgur.com/QxTCD9R.jpg ).

In the fog of war image a directional negative light was used to darken the surroundings. The benefit from this compared to normal lighting is that it also darkened objects which would be lit by torches and such and made toggling the fog of war effect easy.

Comment
Add comment · Show 6 · 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 tanoshimi · Aug 20, 2017 at 02:30 PM 0
Share

But can't you achieve the same effect by using a subtractive blend mode in the shader?

avatar image Fainzeraier tanoshimi · Aug 20, 2017 at 03:01 PM 0
Share

That might work, but couldn't find much info about it with a quick search. Can you share any info or links about that?

Also I wonder how a negative light object could be created, since Light is a sealed class and it's color values are probably now clamped between 0-1.

avatar image tanoshimi Fainzeraier · Aug 20, 2017 at 03:16 PM 0
Share

Simply specify BlendOp Sub in the shader declaration. https://docs.unity3d.com/$$anonymous$$anual/SL-Blend.html

The fact that light is sealed is irrelevant - since you're subtracting the values, to make it darker you want the RGBs to be positive as normal anyway.

Show more comments

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

85 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 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 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 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 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

I need help with directional light 1 Answer

My lighting is weird 1 Answer

The light is not blending 0 Answers

Modify 2D Point Light Distance in runtime? 1 Answer

URP shadow problem 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