Using textureGrad with cube map

Hello,

I have a code in glsl which samples an env map from a given direction.

uniform samplerCube envSampler;
varying vec3 direction;
vec4 envColor = texture(envSampler, direction);

I want to use textureGrad to specify explicit gradient for mipmap level computation.

uniform samplerCube envSampler; (LINEAR_MIPMAP_LINEAR)
varying vec3 direction;
vec4 envColor = texture(envSampler, direction, dFdX(direction), dFdY(direction));

If I read the spec correctly this should give the same result, but in practice it does not. Actually I have slight difference for mipmap level (and sometimes more than one level variation). And I do not multisampling for this test.

Am I completely wrong :slight_smile: ?

See “comparable quality” in Issue (4) in the extension that introduced this function: ARB_shader_texture_lod.

Thanks a lot!

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.