PDA

View Full Version : About Mag and Min Filter



Poma
04-25-2004, 11:07 PM
in openGL, we can use glTexParameter() to set the Mag or Min filter parameter, but in actural implementation, how does it work? For example, if i set Mag = Linear and Min = Nearest, when drawing a pixel, how do i need to do to detect which mode to use? Is the filter's unit a polygon or a pixel? Thx

plasmonster
04-26-2004, 02:27 AM
If you want the nitty gritty, read the spec (http://www.opengl.org/documentation/spec.html) . Go to the rasterization->texturing
section and you'll find more than you ever wanted to know.

Poma
04-27-2004, 06:06 PM
I have read the spec but there are still few things that i don't understand. How do i need to do to calculate the value du/dx. If i don't have texture translation, u = kx. Could you give me an example to calculate the value?

Thank you very much.

ZbuffeR
04-28-2004, 09:17 AM
I think for such answers a look at the source code of Mesa will surely help :
http://www.mesa3d.org/

Christian Schüler
04-29-2004, 06:00 AM
Graphics adapters draw each 2x2 pixel block in parallel to get the derivatives from neighboring pixels.

du/dx would then be proprotional (u from left pixels - u from right pixels)

du/dy = (v from upper pixel - u from lower pixels)

and the same for dv/dx etc.

it all boils down to know how much the texcoords are changing wrt screenspace and selecting your LOD accordingly.

Brian Paul
05-05-2004, 05:25 AM
Whether the minification or magnification filter is used depends on whether lamba (the texture level of detail) is less than or greater than a threshold value. The threshold is either 0.0 or 0.5 depending on the minification filter setting (see the spec).

lambda is computed from the texture coordinate derivatives (ds/dx, ds/dy, dt/dx, dt/dy, etc). The derivatives are easily computed during triangle rasterization. You don't have to be concerned with that though.

-Brian