Jump to content
  • Advertisement
Sign in to follow this  

Problems with Indexed deferred lighting

This topic is 3438 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've almost got my deferred lighting working but I'm stuck with an odd problem. The lights indices are rendered into a texture in the red and green channel. red is set to the index and green is 255 - index. I then use MAX on the blend mode to give me light sorting. This means I have two lights per pixel. The texture is cleared with zero. In the shader I do.. if( index.x > 0.0f ) { process light 0 index.y = 1.0f - index.y;//make the index for the second the correct value. //Using the MAX blend mode for sorting means that these are the same if //only one light is effecting a pixel. if( index.x != index.y ) { process light 1 } } Now this code only works if the light indices used are > 127 if the lights index is less than 128 then the second if that is supposed to stop the pixel being lit twice by the same light always returns true. Using pix index.x and index.y do == the same yet the if(index.x != index.y) still executes the lighting for the second light. Any ideas??? Ta. :)

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!