OpenGL/GLSL - implementation of texture filtering

淺唱寂寞╮ 提交于 2020-01-14 11:45:19

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!