Jump to content
  • Advertisement
Sign in to follow this  


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

Pretty simple question for those who know... I want to render multiple lights in my scene. I've seen a quite a few clever applications of lighting in the DX sample code. On the shadow volume they seem to actually render the scene with a low ambient light then re-render it for every light each adding a semi opacity light over the top of the first render. I would find this quite easy to do. The other option is to set the number of lights in my HLSL and do it in the pixel shader but I'm finding it quite difficult to make the number of lights in my scene dynamic that way. I have to set arrays for positions and directions and all sorts which opens a whole can of worms. The other way allows me to just use one light in my HLSL and reset the parameters every light render. What I want to know is which way is 'the way to do it' bearing in mind that I want to apply quite a few effects to my scene, normal, bump, caustic effects (its an under water scene). Thanks guys, Andy

Share this post

Link to post
Share on other sites
Hmmm..what are your requirements ?
- lighting only or lighting and shadows
- just a demo
- speed
- quality
- easy to implement
- many vs few lights

Well, shadow volumes is a shadow not a pure lighting technique. In this case they might render the scene for each light to get the shadows correctly done. But if you just want to do lighting it would be much faster to do the lighting in only one or just a few render passes. In this case you should indeed use some kind of light-management to get only a small sub-set of your lights in the scene.

Btw. if you want to use shadows too, take a look at shadowmaps. Nowaday most games use shadowmaps instead of shadow volumes. But shadows are much more complecated than pure light calculation.


Share this post

Link to post
Share on other sites
Thanks Ashaman,

No shadows, it would be nice for adaptability so I can add shadows later if I want but in the mean time I have no need for shadows.

It's just a demo.

High quality.

Definitely ease to implement.

A few lights but I'm trying to build a basic engine so that I can reuse most of my code in future projects, so it needs to scale up relatively easily.

I've been told by a few pros now that shadow maps are the way forward. I always thought that shadow volume looked better but then I'm just a novice and probably wasn't using the shadow map properly.

I think getting my head around setting arrays in HLSL is going to a must but some of the things that don't work just don't make any sense. Like you can't just have an array of an unknown size because the loop doesn't work, but you don't get the error on the loop you get it on the variable you used in the loop later on in the shader.

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!