Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Per Pixel Problem

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

Hello everyone. I was looking for some advice on how to get what I have done to look right. Basically I have got per pixel attenuation from a light source and DOT3 bump mapping per light source. Now both work fine on their own as u sinply go through each light adding them to the scene, then modulate the base texture map on top of it, however, when it comes to combining the 2 I have problems as I have multiple lights in the scene. The light attenuation can be put into the scene easily first by adding each light to the frame buffer. This should then be modulated by all the dot3 bump map lights added together, but I cannot do this as each light source is added seperately, ie each light source is modulated one by one as opposed to all teh lights at once. This cuts out light where there should be some. Does anyone have any ideas as to how I could get around this? sorry if my problem is not very clear. I though about rendering each one to texture and then multiplying the 2 resulting polys together but I am worried about slowdown and also the fact that the texture must be a power of 2 and thus scaled. - James

Share this post

Link to post
Share on other sites
Here is where dest alpha is very helpful.

1st pass - ambient & emissive & global reflections & z into frame buffer, write 0x00 to dest alpha

1st per-light pass :

Put attenuation ( optionally * mask texture ) into dest alpha only, leave rgb alone

2nd per-light pass :

Calculate dot3 result * diffuse texture

blend srccolor * dest alpha + destcolor

Ironically, while I invented the 1-d^2 per-pixel attenuation technique, I''m no longer a huge fan of it. For most applications, I would recommend using per-vertex attenuation and tessellating your world a bit more. You could then reduce this to 1 per-light pass instead of two.

I actually burned my distance attenuation into my static occlusion maps for my engine. Before I was doing it per-vertex. This works even better if your lights don''t move.

Share this post

Link to post
Share on other sites

  • 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!