问题
I would like to implement texture filtering (min and magfilter) myself in a GLSL shader (as i want to use image_load_and_store and not a sampler, and also I want to handle undefined pixels in a special way) and I'm looking for an article or so that discusses the filtering process.
I can recall on how to implement texturefiltering from a raytracer I once wrote - I think you need to take into consideration the UV gradients at each pixel and depending on the length of those somehow scale your sampling raster.. but there I used a 49-samples circular kernel, I think that's too heavy.
I think the UV gradients i can get using dFdx() and dFdy() - but I'd like to know how what kind of kernel openGL is using for the filtering and implement it in my glsl shader the same way.
also - how to distinguish whether a minfilter or a magfilter needs to be applied? and is the filtering process different?
last but not least: if its minification filtering, how to choose the appropriate mipmap level based on the UV gradients?
回答1:
There's an article over at Codeproject which implements different filters (among them bi-linear) in GLSL: link
来源:https://stackoverflow.com/questions/9805574/opengl-glsl-implementation-of-texture-filtering