Hi,
I have a 4x4 float texture containing positions ranging from 0 …10.
I have a lookup float texture a 64x64x64 packed as a 2D texture 64x4096 containing some vectors in each texel.
the 64x64x64 is packed into a 64x4096 2d image:
data[y * height + z+0] = value;
data[y * height + z+1] = value;
data[y * height + z+2] = value;
data[y * height + z+3] = value;
I wish to use the value from the 4x4 texture as a lookup into my 64x4096 texture.
However when I try to generate texture coords to lookup into my vector texture I just get garbage.
Here is how I am generating tex coords:
//get our position
vec2 texCoord = gl_TexCoord[0].xy;
vec4 position = texture2D(positions, texCoord);
//generate tex coords
float u = (float(position.x * width))/width ;
float v = float( position.y * height + position.z)/height ;
vec4 vector = texture2D(noise, vec2(u,v));
Does anyone know what I’m doing wrong?