- Home /
Exclude objects from lights
Is there a way, that I can exclude specific objects from lights (I know about layers, but for my problem it will not work).
I want to make a game, which is tile based. A user can define with an editor, different rooms, and doors on this tile based map. Afterwards he can add lights (torches) at the wall.
This is all runtime, so I cannot use baked lights.
I want to create for each torch at the wall a point light, with some range. This should light into the room and against the wall, but because of the light is close to the wall, this means if on the other side of the wall is also a room, then this floor will be lit too.
I could solve this with casting shadows by the point light, but this slows down the performance.
My plan was to just ignore all objects lit, which are on the opposite side of the wall (like a cutting plane).
Is this possible with unity?
Answer by dethtoll · Mar 19, 2015 at 04:03 AM
A quick Google search leads to the Unity documentation page for Light. The "Culling Mask" property sounds like it could meet your needs.
thank you for this information. Unfortunately for the culling mask I need layers, which are limited and therefore for a tiling map of 32x32 tiles, this would need 1024 layers. If I am right, unity does not support so many layers.
A quick Look at Culling $$anonymous$$ask reveals that it involves layers. Which the OP stated he didn't want to use.
Your answer
Follow this Question
Related Questions
Make a Lava Object Shiny 1 Answer
Light position 1 Answer
How to fix the light passes through the object 1 Answer