OpenGL / GLSL - Texture Filtering Implementation

I would like to implement texture filtering (min and magfilter) myself in a GLSL shader (since I want to use image_load_and_store, not a sampler, and also I want to handle undefined pixels in a special way) m looking for an article or such to discuss the filtering process.

I can remember how to implement texturing from a raytracer that I once wrote - I think you need to take UV gradients into account on each pixel and depending on their length somehow scale your raster sample .. but there I used 49 -shaped circular core, I think it's too hard.

I think UV gradients I can use dFdx () and dFdy (), but I would like to know how the openGL core uses for filtering and implements it in my glsl shader in the same way.

also - how to tell if minfilter or magfilter should be applied? and is the filtration process different?

Last but not least, if its filtering is minimization, how to choose an appropriate mipmap level based on UV gradients?


source to share

1 answer

Codeproject has an article that implements various filters (including bilinear ones) in GLSL: link



All Articles