• 3D
  • Am I misunderstanding light_cull_mask?

I have a 3D scene with multiple light sources, and want some of the objects in the scene to be illuminated by one specific light which affects just those objects. (Yes, it's not realistic, that's kind of the point.) I thought this would be possible by putting those objects on their own layer and adjusting the cull masks of the lights so that the one meant for those objects had just their layer selected and all the others had that layer deselected. But everything reacts to all the lights. Am I missing the point of light_cull_mask, or using it incorrectly? Or is there a better way of doing what I want?

25 days later

I don't think your missing anything, this sounds like exactly how it should work. I just tested as follows:

Light is culled on layer 1, showing on all other layers:

Left cube in layer 2 = lit:

Right cube in layer 1 = not lit:

I guess the only thing I would check is that all of your other lights have been limited to only affect Layer 1. By default, Light is applied to all layers.

@Bimbam said: I don't think your missing anything, this sounds like exactly how it should work. I just tested as follows:

OK, I've just tried reproducing your scene -- one cube on layer 1, one cube on layer 2, spotlight with layer 1 of the cull mask off, nothing else -- and still got the same problem: the spotlight lighting both cubes. Thinking about what could be different about our scenes, it suddenly struck me that I was working in GLES2. And guess what? Switching to GLES3 made everything work as expected. Now I just need to weigh up which is more important for this project.

@sarrowsmith said: Switching to GLES3 made everything work as expected. Now I just need to weigh up which is more important for this project.

Further testing shows that it's not just GLES3, it also doesn't work with directional lights. And a spot just isn't working for me. So I guess that settles that.