Jump to content
  • Advertisement
Sign in to follow this  
Tree Penguin

GLSL texture2DGrad and texture2D

This topic is 3823 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi. Because of manual tiling in a fragment shader, I need to supply texture coordinate derivatives myself to avoid mipmapping artifacts at the texture borders, as you can see here. I first tried texture2DLod, but that doesn't support anisotropic filtering. texture2DGrad does (according to the GLSL and g80 specs) but I am having a hard time replicating the AF quality (or even getting AF at all) I get with a normal texture2D call. My question is, shouldn't these two calls (below) give the same results. If not, what am I doing wrong? If so, is there any other reason these two lines would have different outcomes? texture2D(sampler, tc); texture2DGrad(sampler, tc, dFdx(tc.x), dFdy(tc.y)); Thanks!

Share this post


Link to post
Share on other sites
Advertisement
Sorry, it appears I should've used

texture2DGrad(sampler, tc, dFdx(tc), dFdy(tc));

as ddx and ddy are vec2 parameters and dFdx and dFdy give you the same type as you feed them.

Another afternoon wasted on misreading something :(.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!