I have a shader in glsl that is using a 3D texture to create some shading effects.
I am currently using texelFetch() but now need to use interpolated LOD levels to achieve the final effect.
The texture is declared like this:
uniform layout(binding=0) sampler3D diffuse_map;
And then I sample it like this using texelfetch():
vec4 val = texelFetch(normal_map, ivec3(((r)*0.5/cube_dim+vec3(0.5))*(voxel_resolution-1)),0);
The above works.
I then try to sample the same texture with textureLod as follows:
vec4 val = textureLod(normal_map, ivec3(((r)*0.5/cube_dim+vec3(0.5))*(voxel_resolution-1)),0);
I am guessing this fails because the coordinate system is different for textureLod, but then, what is the range for the coordinate for this function?
The documentation does not explicitly state it, and soemtimes the coordinate system is that of the texture, soemtimes is 0 to 1 and soemtimes it's -1 to 1