Hi All
How can I get a size of current fragment in GLSL 3.3 shader? In other words, what is a size (in UV coordinates) of area covered by currently shaded pixel?
Thx
Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!
Hi All
How can I get a size of current fragment in GLSL 3.3 shader? In other words, what is a size (in UV coordinates) of area covered by currently shaded pixel?
Thx
Im not 100% sure about your question but I think this resource can help you: http://www.opengl-tutorial.org/beginners-tutorials/tutorial-5-a-textured-cube/
You'll want to use dFdx and dFdy. They tell you how much a value changes when moving to a neighboring pixel in the X or Y direction, which you can use to estimate the pixel's footprint in UV space. Incidentally this is exactly what GPUs do to automatically compute mip levels and anisotropic filtering.