Re: [osg-users] Lookup texture coordinate issue

2014-05-17 Thread Paul Pocock

It's sorted.My tex coordinate generation was wrong.. :P


On 17/05/14 09:50, Paul Pocock wrote:

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:
width=64, height=4096


//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));

It seems correct way to index into my LUT.Does anyone know what I'm 
doing wrong?

Regards
P

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Lookup texture coordinate issue

2014-05-16 Thread Paul Pocock

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:
width=64, height=4096


//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));

It seems correct way to index into my LUT.Does anyone know what I'm 
doing wrong?

Regards
P

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org