I want to create a dark scene. The player just got a torch in his hands so this is the only light in the scene.
So the rest of the area should have no lights in it. Maybe it's a cave or a dark forest?
In Pokemon you had this effect in dungeons
Here is a rough sketch how I imagine it
So when I want to set the directional light of the scene to complete black color, you can still see good enough.
How can I archieve these effects of having a dark world?
I don't want to use a texture around the player or something like that. Maybe you can still see through darkness but really really badly.
Use this scene as an example of how to do that:
https://github.com/Galandil74/Unity-Spotlights-Example
Basically, as Lestat already said, you set the overall brightness by changing RenderSettings.ambientLight
, then to create the torch effect, you use a directional light game object with a texture cookie in order to illuminate only a portion/shape of the screen.
Remember that to get full illumination through the cookie texture, the light must have its intensity
propriety set to 1 - RenderSettings.ambientLight.grayScale
(if it's a directional light).
I prefer to use directional light because you can then control the effect via the alpha channel of the cookie texture.
And if you're using sprites (for background, etc.), if you want them to be affected by the ambient light, remember to use the Sprites/Diffuse
material.
I know I am 6 years late to this thread, but I figured I'd comment anyway for future finders like me!
I found this as I was searching for similar but in 3D and solved it by
Then I deleted the directional light and changed the general lighting settings in the environment tab to:
Environment Lighting > Intensity Multiplier -> 0
Environment Reflections > Source -> Custom
Then I attached the GameObject to the player as a child and it worked perfectly!
If you want it to be slightly lighter gradually out you can duplicate it, make the range bigger and intensity down.
I find this to be a way easier way than scripting the directional light, hope it helps someone!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With