- Home /
How to restrict directional light to a band?
Hi to All,
Is is possible to restrict directional light to a band? Some gameobjects are lighted based on their position, some are not? (out of area) I am using ortho camera
Thx for answers
Answer by Eric5h5 · Oct 04, 2012 at 05:19 PM
You could potentially use a light cookie.
Thx, I tried to understand what is it, but surely my lighting and 3D skills are very basic.
Can I apply this for multiple objects? I mean I would like to say 10 gameObject to be lighted by a Directional_Light_1, and other 10 gameObject to be lighted by a Directional_Light_2.
If this is can not possible with Directional Light is there any method which has similar effect? The object group one is within 30 unit in X and Y, camera looks to Z, light direction also Z, and the other group has 100 unit far in direction X. (with other camera and light) I do not want to summed the lights when both lights are on, with other words I do not want to lit group1 with light 2 and group2 with light 1
(In reality I have 5 groups :-)
Thx for answers
Ohh... well now, that's easier. If you put 10 objects onto one layer, and 10 objects onto a different layer, you can tell a directional light to only light up a specific layer.
Note, though, that the number of layers is limited. This technique definitely won't work if you want more than 32 layers (and, since some layers are reserved, you really shouldn't use it for more than about 20). For 5 layers of objects, it will work fine.
But don't you then have to detect when objects enter/leave the area of effect and make them change layers?
And how would this technique work on the floor, which would probably exist in both areas.
This technique wouldn't work on the floor, but yes, as long as you had a way to detect when objects entered/left an area, you could make them change layers and the light on them would change.
Eww, in that case wouldn't they be flipping from fully lit to full darkness? Admittedly you could gradient the change but it unfortunately doesn't give the "cut in half" effect that using a light cookie could potentially help with.
I think Eric's idea is the solution.
Your answer
Follow this Question
Related Questions
2D Animation does not start 1 Answer
2d Lighting - Weird light triangles 0 Answers
2D. Point light not working on Android 0 Answers
I can't use 2D lights 2 Answers
Light of Sight - 2D Dynamic Lighting (Field of View) 0 Answers