Jump to content
  • Advertisement
Sign in to follow this  
KevinCoyle

Multiple vertex shader point lights

This topic is 5200 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 currently learning about vertex and pixel shaders and I've created a shader that lights a scene with a single point light. I've been trying to figure out a good way to do more then one light (variable amount). I found this thread here http://www.gamedev.net/community/forums/topic.asp?topic_id=108572 and it makes some sense however I noticed the thread was from 2002, since there are newer shader versions I was wondering if there was a better or more accepted way of doing this nowadays.

Share this post


Link to post
Share on other sites
Advertisement
If you're doing per-vertex lighting, simply compute the lighting terms for each light and add them up. If you're doing per-pixel lighting, things get a little more complex. You'll need to pass the vertex-to-light vectors to the pixel shader as texture coordinates or colors and compute the lighting terms there. Due to the limited number of input registers, you could handle only about 3 or 4 lights per pass.

Share this post


Link to post
Share on other sites
On modern ps profiles (2.0 and up), one could encode the lighting parameters in textures, effectively enabling many more lights than if the lights were encoded in the texture coordinate data.

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!