Jump to content
  • Advertisement
Sign in to follow this  
Chordogg

question on spotlights

This topic is 4304 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

im really interested in doing per pixel spotlights, but im curious on how to prevent the light from bleeding through the walls. like in the source engine im pretty sure the spotlights dont go through the walls. is there a robust way to kind of mask out the light so it doesnt go through walls?

Share this post


Link to post
Share on other sites
Advertisement
In my opinion,it must be some kind of tech like ShadowMap, or Shadow Volume. What ever , you can't make it in normal way.

Share this post


Link to post
Share on other sites
The simplest way is to implement some sort of a scene graph system with grouping. If you know that the spotlight is inside a closed surface, say a room, you can create a group node in the scene graph and place the room, the light and all the objects inside the room in that group node. When you render the scene, you enable the spotlight for all the objects in that group and disable the light for the objects that are not in that group, that's it.

And then there is also ray tracing, where you get shadows and non-penetrating lights for free. But it's too slow to do it in realtime.

Share this post


Link to post
Share on other sites
But if some object is big like wall. May be only part of those obj inside the "room of Light". How do you deal with that. You can't let the whole object be "lighted". And i don't think it's a good idea to seperate those things into many small parts.

Share this post


Link to post
Share on other sites
Quote:
Original post by DeeFar
But if some object is big like wall. May be only part of those obj inside the "room of Light". How do you deal with that. You can't let the whole object be "lighted". And i don't think it's a good idea to seperate those things into many small parts.


Haha, well, you deal with that by making sure that the player never sees the artifacts. If the player is inside the room he won't see what's going on outside the room. If the player is outside the room you just turn off the light.

Share this post


Link to post
Share on other sites
But if I turn off the light just because the player is outside the room it's possible I'd still get artifacts. Maybe he's outside the room but because the way the geometry is set up it may still be visible to see the spotlight. I suppose I'd have to apply some shadow technique ultimately...Maybe shadow volumes. Always perplexed on how to get shadow volumes running quickly when you have to calculate a new shadow volume for the world geometry every time the player moves! Optimizations are a pain, heh. I wish computers were fast enough where we could throw whatever painfully slow algorithm at it we want and it'll still run at 100 fps :)

Share this post


Link to post
Share on other sites
If the spot light is "Small", maybe we can use an active "Light Map". And in my opinion, Shadow Volume is an older way to build shadow. For we have the support of shader 3.0 and huge graghic memory, i prefer using ShadowMap.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!