Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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 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.

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

Why Does Lightmapping make everything Super Bright? 0 Answers

Light Mapping Question - Individual objects/prefabs 0 Answers

Access 'Lightmapping' property in light via C#. 0 Answers

Black squares on a lightmap 2 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