• 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 syaped · Feb 21, 2015 at 10:02 PM · lightlightmappingblacknegative

Negative Lights

This question has been asked occasionally over the years but no real solution given. Is it possible for lights to have a negative value and be used to darken areas? Even if it's just for the purpose of lightmapping it would be useful...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

2 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by petersvp · Oct 23, 2016 at 02:54 PM

if Deferred Lighting mode only, you can hack the light's color to be negative. Since the built-in color selector is clamped to normalized colors, you cannot use it. You can set negative colors from code, like, l.color = new Color(-0.4f, -0.4f, -0.4f, 1); or just use the following script and attach it to a light, then hack as you like.

 using UnityEngine;

 [ExecuteInEditMode]
 [RequireComponent(typeof(Light))]
 public class HackedLight : MonoBehaviour {

     public Vector4 hackColor;
     public float multiplier = 1;
 
     void Update ()
     {
         var light = GetComponent<Light>();
         light.color = new Color(hackColor.x, hackColor.y, hackColor.z, hackColor.w) * multiplier;
     }
 }

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 MaciejGliwa · Nov 02, 2016 at 05:13 PM 0
Share

is this technique going to work in the latest Unity 5.4 or 5.5 beta? I tried it but it doesn't seem to work. Even though I put negative values to the color, the light has no effect at all.

avatar image petersvp MaciejGliwa · Nov 02, 2016 at 05:18 PM 0
Share

$$anonymous$$ake sure you are using Deferred Lighting mode in your $$anonymous$$ain camera.

avatar image MaciejGliwa petersvp · Nov 02, 2016 at 08:17 PM 0
Share

got it, works great! thank you!

Show more comments
avatar image tanoshimi MaciejGliwa · Nov 03, 2016 at 07:58 PM 0
Share

Well, if you've only got a single point light in the scene, it's not going to have an effect. You can't subtract light when there's no other light source giving light from which to take away...

avatar image MaciejGliwa tanoshimi · Nov 03, 2016 at 08:05 PM 0
Share

I have directional light in the scene too. I even created a bunch of extra lights just in case to see if that would be a problem, but nope, that's not it.

avatar image
-4

Answer by gkepets · Feb 22, 2015 at 03:06 PM

make a light and the color of the light black, or a dark color.

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 christophfranke123 · Jul 01, 2015 at 10:16 AM 0
Share

This is not how it works. A black light is the exact same thing as no light.

avatar image petersvp christophfranke123 · Oct 23, 2016 at 02:54 PM 0
Share

Black light means no light. The light color must be negative.

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

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Lightmapping, Non-static objects have black patches 0 Answers

Fix light stroke in terrain 0 Answers

interior lighting with unity 5.3/5.4 and enlighten 0 Answers

Smooth Lighting/Texturing on iOS - Preventing Banding 1 Answer

Emissive Materials not Casting any light after lighmapping 0 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges