- Home /
Pure black lighting
Hi what i have is a cave that is lit using directional light. What i want to have is the cave in total darkness inside, however the lighting i have seems to light everything with out thinking about other objects blocking the path of light. Is there any way to get almost a fog of darkness inside
Im sorry im very bad at explaining things, Thanks for your help
Answer by cgcookie · Jan 07, 2013 at 01:23 AM
This is because there is no shadows being cast, place a white point light in the cave with negative brightness ought to fix that for you ;)
EDIT:
Ah I forgot we can't do negative point lights, we will be covering how to do surface lights which allow light subtracting but this won't be out until february: http://forum.unity3d.com/threads/165056-Noob-to-Pro-Shader-writing-in-Unity-4
/EDIT
Or alternatively edit the texture so it is black inside.
I hope this helps!
Answer by petersvp · Oct 23, 2016 at 03:01 PM
By the way you can have negative point lights in Deferred Rendering!
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;
}
}