Sign in to follow this  

Multiple vertex shader point lights

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

This topic is 4864 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this