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 88kennedy · Mar 01, 2014 at 09:19 PM · shadowlights

How do I create a light that emits darkness?

Kinda strange I know and I have been searching for a couple days trying to find not only an answer but a better way of asking the question. Basically I want to be able to take a harshly lit environment and stick a point light into it but instead of adding light to the are I want the new light to add darkness. I tried looking for answers under the topic of inverted light sources and shadows etc and even tried to implement a projector but it is just not the effect I am looking for. I remember some time ago having the ability to move the brightness setting on a light into the negative range and it produced an effect similar to what I am looking for but that ability no longer exists (and may have been a glitch when I did it). Any help or direction would be greatly appreciated.

Comment
Add comment · Show 11
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 DubstepDragon · Mar 01, 2014 at 09:27 PM 0
Share

I am not sure, but perhaps you can use a light and set its color to black. Tell me if that works :D

avatar image petersvp DubstepDragon · Oct 24, 2016 at 02:15 PM 0
Share

Black means no light contribution, since it's additive and black is complete zero. He must use negative color for this purpose. This only works from code and only in Deferred.

avatar image Lo0NuhtiK · Mar 01, 2014 at 09:44 PM 0
Share

Dr. Evil : "I will create a light that emits... DAR$$anonymous$$NESS!" (pinky-finger to corner of mouth) "$$anonymous$$uahahaha."

avatar image highpockets · Mar 01, 2014 at 09:55 PM 0
Share

This sounds like a trick question... I must have missed something in high school

avatar image 88kennedy · Mar 01, 2014 at 11:28 PM 0
Share

Dubstep, tried a "black light" first but all that does is negate the brightness level of the light it seems. and highpockets, I dont think you missed anything in highschool but the additive nature of the unity lighting environment seems to indicate that I cannot create a "light suck" to remove light, but emiting darkness I think might be doable

avatar image Kiloblargh · Mar 02, 2014 at 02:31 AM 1
Share

You need a custom CG shader; that's the long and the short of it. I can't help you writing that shader, but you can find examples of shader code that simulates a point light when there is no real light in the scene, once you have that working it shouldn't be too hard to make it do the opposite.

Show more comments

3 Replies

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

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

In Deferred Lighting mode, 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.

 #if UNITY_EDITOR
 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;
     }
 }
 #endif

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 persijn · Oct 23, 2016 at 02:57 PM 0
Share

Wouldent it be better to set the new light at startup and not in update?

avatar image petersvp persijn · Oct 24, 2016 at 02:13 PM 0
Share

I've altered the original script to #ifdef it completely. Since it's indeed an editor script, you want it to work in Update. Editor scripts does not execute all over the time, like in-game scripts. And since this script alters Light's color be Light Reference, removing it keeps the light's color as set up

avatar image 88kennedy · Oct 24, 2016 at 01:59 PM 0
Share

This looks like it's exactly what I was looking for. Thank you

avatar image
1

Answer by jemonsuarez · Oct 23, 2016 at 03:10 PM

Projectors works well enough for that purpose.

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 Stratosphere_Studios · Mar 08, 2014 at 07:28 PM

If you want a dark scene, like one in Slender, then I suggest going into Edit > Render Settings and tick fog, change the density to a higher value, change it's colours to almost pitch black and then remove any light sources in the scene. By doing that you can get a dark looking scene. For a light that emits darkness, it's impossible as far as I know.

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

29 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

Related Questions

Light pass under walls 0 Answers

Objects selectively receive shadows 0 Answers

Shadows not behaving as expected with spot lights 1 Answer

Real time shadows problem, please help 3 Answers

Making an object appear completely black until a light source is moved nearby 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