Jump to content
  • Advertisement
Sign in to follow this  
Aqua Costa

[DirectX 10] Multiple ligths

This topic is 3008 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 want to create a shader to handle multiple lights... This is my idea (one pass): -Create an array of lights (specifying light type, position, direction, etc); -Pass the array to the shader; -Create a loop and keep adding the diffuse/specular colour of each light to each pixel; Is this technique good or what should I change? Is there any good whitepaper/doc talking about multiple lights?

Share this post


Link to post
Share on other sites
Advertisement
At the very beginning of my own engine, I tried that, too. If you really know the light you will use, it is *may* a way. But if you want the user to create some lights, it's just horrible.

When you need many dynamic lights, you may take a look at this article: Deferred Rendering Demystified

When you need not so many dynamic lights, you could use forward rendering. This is done by drawing the mesh for each light on top of the other again and blending it together. So, if you have 4 lights, the mesh would be renderd 5 times: 1 Diffuse, 4 lights. Thats pretty slow for many of them.

If you don't need any dynamic lights, it is best to pre process some lightmaps. This means: Calculate the lighting once, save it to lightmaps and put them on the meshes. I never did that before, so I don't know how to do that. ;)

I hope this helped :)

Share this post


Link to post
Share on other sites
For what ive read so far, there is a problem with semi-transparent objects...
How are they rendered in Deferred rendering??

Share this post


Link to post
Share on other sites
I know this problem, too. Maybe you can render them with forward rendering?
Also, I don't really know what happens when you draw them like any other object. When I think about it, there shouldn't be a problem but that the light color will not modulate with you glass/water/whatever. And your light will go through walls anyways.

Please correct me if I am wrong. Haven't tested it so far...

Share this post


Link to post
Share on other sites
I'm building in Deferred Lighting at the moment. I think this is the better solution, as I need many dynamic lights. Forward rendering is simple, but too slow for my needs.

What kind of game do you make? Do you need *many* lights? Or just a few?

Share this post


Link to post
Share on other sites
I wanna create a first or third person shooter (I haven't decided yet), just a little level. So I will need a parallel directional light (the sun), and some point/spot lights. But I want to set up my engine to be able to handle good graphics from the beginning so I think I will try to implement deferred rendering.

Do you know any good article about Deferred rendering in DiretcX 10, because that article "Deferred rendering demystified isn't directX 10 at all

How long did it took you to implement DR?

Share this post


Link to post
Share on other sites
I'm currently on it, and I also use DirectX10. Anyways, the steps are the same. Set up MRTs, render GBuffer/Depth,etc. Render it to full screen quads, calculate them together. I'm at the step with the FullScreen quads. As I got there I moved on with post processing, to have a good interface for that. Also I will use it to finish my deferred lighting pipeline. Getting there took me some hours of work, but not THAT long.

For a first person shooter deferred lighting is best (For dynamic use)!

Share this post


Link to post
Share on other sites
Ok, I will try to implement DR.
Thank's for your help

P.S. Do you use any book like ShaderX series to learn techniques? Because I was thinking about buying Shader X7

Share this post


Link to post
Share on other sites
No, I did not use any book for that. But you can check out GPU gems from nvida:
http://http.developer.nvidia.com/GPUGems3/gpugems3_part01.html

there was an article about that. Maybe it was the 2nd part. I don't know now. Anyways, it is a good resourde :)

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!