Jump to content
  • Advertisement
Sign in to follow this  
matches81

What lighting/shadowing should I use?

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

Hi there once again! I´m currently planning a project with some friends of mine. Type of game is an action-adventure with 2D gameplay (like Flashback or Blackthorne) but 3D graphics, which means perspective will be fixed side-scroller-like (perhaps with some degree of rotation), but the graphics engine should be 3D. Now I came to realize that it is quite important for the engine how you render the lights and the shadows. First about lights: I´ve read about some methods rendering one pass per light, which means rendering all geometry affected by that light in a pass and adding all those passes together afterwards. The other approach I´ve read about is rendering the geometry just one time using a distinct number of lights having the most effect on any batch I render. I imagine the first solution would have better performance for less lights with less (or none at all) decrease in lighting qualitiy, while the second approach will trade speed for quality when using more lights. Am I correct about this? At what number of lights does the first approach get painful normally? How would a scenegraph considering lights look like with these two different approaches? Now about shadows: I realize there are also 2 different approaches to shadows, the first being shadow volumes and the second being shadow maps. First question that comes to my mind: Consider I´ve successfully implemented calculation of a shadow map, how do I map it correctly onto existing geometry? That question really bothers me because I can´t imagine a good way to solve that... Same goes for shadow volumes: Say I´ve constructed the volume for some geometry. How do I apply the intersections of that volume with other geometry efficiently as shadow? Let´s get to the basic problem I have: Consider I would have about 4 or 5 NPC´s and player character on the screen, add to that some animated background objects and platforms that move. What shadow technique is more suitable? It seems to me that shadow maps are getting more and more high-res and faster recently, and I´ve read some posts mentioning their getting better support in hardware. So, if I want some decent looking shadows (which means more or less soft ones, depending on the light source), should I go for shadow maps? Thx for taking the time to read and for possible answers / clues in advance ;) [edit] Oh... I forgot to mention that I would really appreciate any good papers about any of the methods mentioned, but I don´t learn too much from "do this call here, that function there and TADA! it works" kind of tutorials. I think I´ll get the point better with some well-explained math and the reason for the math behind it and I kind of really get to like this math stuff :) Another thing I forgot is why I posted this in the DirectX Forum: We´re going to implement the game in C++ / DirectX, but that shouldn´t matter too much with the topic of this post, so if it seems unfitting, feel free to move to graphics programming or game programming or something... [/edit]

Share this post


Link to post
Share on other sites
Advertisement
As far as lighting goes, if you want simplicity, you could just start out using Direct3D lights, which work fairly well. Just make sure your ground quads are well tesselated. If you use Direct3D lights, you can render with up to 8 or 9 enabled without much performance hit. This is what I've heard and read anyway.

There are other shadowing methods too, such as Planar Shadows, which might work perfectly for your 2D game. There are several good articles here on Gamedev.net. Just click the link "Articles" at the top and search for shadows.

Share this post


Link to post
Share on other sites
thx for the reply, I was going to use HLSL shaders ONLY for the engine, so no FFP rendering. At least that´s the plan. So a point light would basically be a location vector, a color and a radius (and perhaps a falloff type, but that is not fully decided yet), a directional light would be just a direction vector and a color and so on... but that wasn´t what I was wondering about. I was wondering about lighting in combination with batching especially, perhaps I wasn´t that clear about that.

So my question is: Is it better to sort the rendering based on lights first, rendering one pass per light and add all those passes together for the final product or should I enhance every object with pointers to lights that affect its appearance most and render that object with those lights or do something different?
I am looking for some tutorials and / or papers about managing lights.

Thx for the tip to look in the gamedev articles for shadowing. Though I didn´t find an article about shadow maps, I found some about shadow volumes and something based upon shadow maps which looked quite nice... so I will look for some tutorials or articles about shadow maps and some other shadowing techniques and decide about that thing later.
Most important thing right now is that light management stuff, which keeps me confused.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!