Jump to content
  • Advertisement
Sign in to follow this  

Lighting in a 3D, top-down game

This topic is 2940 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

I'm working on this top-down shooter, where the world at the moment is basically separated into two VBO's. One is for the floor/ground, which is based on a heightmap, the other is for the walls and hills and other things of that nature that are used to restrict the player's movement. I don't know if this split actually makes any sense, but it's what I ended up going for because it made it very easy to do collision detection, and easily turned into a grid for pathfinding.

However, my main problem at the moment is the lighting. Let's say I want to put a light on one side of the level. This light should only light an area around it, and the light shouldn't go through walls. I only know the basics of shader programming, to the point that I can implement a basic blinn-phong shading model and directional lights, but have no idea how to actually make things like walls stop light from going through.

So in a nutshell, how do I make it so that the player can only see what's in front of him*? Also, walls should block line of sight to avoid adding xray vision to the player's powers.

*remember, this is a top-down game, so "in front of the player" means in the direction the player is looking, not where the camera is looking

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!