Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 6 of 6

Thread: About Mag and Min Filter

  1. #1
    Junior Member Newbie
    Join Date
    Mar 2004
    Posts
    18

    About Mag and Min Filter

    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

  2. #2
    Advanced Member Frequent Contributor plasmonster's Avatar
    Join Date
    Mar 2004
    Posts
    739

    Re: About Mag and Min Filter

    If you want the nitty gritty, read the spec . Go to the rasterization->texturing
    section and you'll find more than you ever wanted to know.

  3. #3
    Junior Member Newbie
    Join Date
    Mar 2004
    Posts
    18

    Re: About Mag and Min Filter

    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.

  4. #4
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,580

    Re: About Mag and Min Filter

    I think for such answers a look at the source code of Mesa will surely help :
    http://www.mesa3d.org/

  5. #5
    Junior Member Regular Contributor
    Join Date
    Oct 2003
    Location
    Hamburg, Germany
    Posts
    117

    Re: About Mag and Min Filter

    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.

  6. #6
    Intern Newbie
    Join Date
    Jan 2002
    Location
    Steamboat Springs, CO, USA
    Posts
    43

    Re: About Mag and Min Filter

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •