Point lamp through walls

How do I prevent point lamps from lighting through walls? the point lamps in the picture are behind the wall



I use points lamps for light coming from lights that are longer than they are wide…the ones kind of like at shopping malls, depending on where you go
Is it better that I use spot lamps instead? I just want a certain part of the floor and surroundings to be illuminated

Thanks

All lights go through walls. No way to stop it. You could use a spot and have it not go that far over. But other than that just wait for people who edit the source.

have the light added when the player is in that room, and removed when he is not,

There are a few choices, none of them are super simple though.

The easiest one is to enable “sphere” on the light, which sets a hard limit on how far the light can travel; then you can place the light and set the distance so that the light doesn’t reach into the other room. The drawback is that the corners of the room the light is in will probably be dark. (the light still travels through walls, “sphere” just allows you to set limits on the distance it can reach)

The method I recommend is to bake the lights into a lightmap for the rooms, there’s a bunch of manual setup required but baked lighting runs much faster than dynamic lights, and you can use rendering techniques like ambient occlusion and raytraced shadows to get a very nice look (most modern AAA games use a mix of baked and dynamic lights depending on the effect they’re going for). The drawbacks are basically that your lighting can’t be dynamic, so if you have any lights that have to flicker or turn off you won’t be able to use this technique for them.

The other option is to use lights the way you’re using them, but split each room into a different layer, and enable “this layer only” on the lights. The result is that the light will only effect objects that are in the same layer as them (you can put objects across multiple layers if you want the lights from multiple rooms to effect them).

All lights go through walls.

Actually that isn’t really the case. spot lamps don’t, but they are kind of unrealistic because it shoots a spot at the floor with no light going elsewhere. sun and hemi lamps just go through everything, if you’re doing an outdoor scene

forgot to mention I’m using GLSL for this

have the light added when the player is in that room, and removed when he is not,

I like the idea, until I realized that I need something to be always on. This is so that the player can see a lit room and go towards it

@Captain O
Great ideas. I think that these are premium ideas I can actually to make the game lighting definitely more realistic. I can do them but with my current setup of my game, option 3 and option 1 are out for my particular game…It will take me a bit of learning to understand how to use raytraced shadows and any other baking techniques besides normal and ambient though

I think I’ll just stick with my original “solve” that is much worse than any of you ideas: spot lamp with sphere enabled. I know this is inefficient and takes up a lot of GPU resources…but… :confused:

Really? I thought they did. Although I don’t use spots. Meh. :spin:

That isn’t true, the spot lamps through surfaces:


It depend of the normals. But, you can enable shadows to avoid it, but point light have no shadows.

So I was right? :spin: I just dunno anymore lol! Your signature, though… Your english is fine! Lol. Way more understandable than most Americans!