Sign in to follow this  

Problems with Indexed deferred lighting

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

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