View Full Version : Deferred Shading and Texturing

04-20-2007, 05:55 AM

I just stumbled across an issue with deferred shading, that I never heard of before.

When I apply the lights to the gbuffer, I draw screen-aligned quads, using an orthographic projection matrix.

Today I realized that this completely breaks mipmap selection for, say projected lights. Since ds/dx and dt/dy are not dependend on the surface I shade (the screen-quad is not the surface!), mipmapping seems to be disabled for the light´s texture (or any other texture I sample in the shading pass)?! The problem becomes especially apparent when sampling an environmap cubemap.

How to circumvent the problem?

04-20-2007, 06:20 AM
And what about storing your derivatives within your gbuffer, at the same time as zbuffer for instance ?

04-20-2007, 10:17 AM
I still have some space in the gbuffer :)

So, what values would I have to store and how to use them in order to select the appropriate mipmap level?

I´m not confident in the maths of these derivates :(