3d floating point textures on nvidia...

Hi all -

I’m attempting to make 3D floating point textures… non-pow-2 would be even nicer, but I’ll take what I can get. Right now I’ve got something like:


glBindTexture(GL_TEXTURE_3D_EXT,m_currentID);
	glTexImage3DEXT(GL_TEXTURE_3D_EXT,0,GL_FLOAT_RGB32_NV,64,64,64,0,GL_RGB,				GL_FLOAT,array);
[\code]

but I get an "invalid operation" back from glGetError().

Can anybody help me out here?

Thanks,
  Brian

Floating point textures are restricted to the TEXTURE_RECTANGLE_NV texture target with the GL_NV_float_buffer extension.

Originally posted by jra101:
Floating point textures are restricted to the TEXTURE_RECTANGLE_NV texture target with the GL_NV_float_buffer extension.

Any way to use TEXTURE_RECTANGLE_NV with 3D Textures?

Thanks

ATI’s R300 series supports 1D, 2D, and 3D floating point textures via the GL_ATI_texture_float extension. I don’t know if changing your hardware is an option, though.

Having generalized support for floating point textures is extremely useful.

– Zeno

[This message has been edited by Zeno (edited 05-04-2003).]

Originally posted by Zeno:
[b]ATI’s R300 series supports 1D, 2D, and 3D floating point textures via the GL_ATI_texture_float extension. I don’t know if changing your hardware is an option, though.

Having generalized support for floating point textures is extremely useful.
(edited 05-04-2003).][/b]

I agree, however, having a large number of dependant texture reads is also extremely useful.

I actually have both an FX card and a 9800… neither one by itself does the trick

I guess I’ll just have to wait until the next round of cards comes out…

Brian

Out of interest, what’s the trick? If you’re willing to tell, of course. Perhaps someone could come up with a better solution.

-Ilkka

Originally posted by graphicsMan:
I agree, however, having a large number of dependant texture reads is also extremely useful.

Good call. I’ve bumped into this limit on the 9700 .

If you can, do what JustHanging suggests and say what you’re trying to accomplish…maybe we can help.

Originally posted by graphicsMan:
Any way to use TEXTURE_RECTANGLE_NV with 3D Textures?

RTFM, http://oss.sgi.com/projects/ogl-sample/registry/NV/texture_rectangle.txt
http://oss.sgi.com/projects/ogl-sample/registry/NV/float_buffer.txt

In your case,
glBindTexture(GL_TEXTURE_RECTANGLE_NV,m_currentID);
glTexImage3DEXT(GL_TEXTURE_RECTANGLE_NV,0,GL_FLOAT_RGB32_NV,64,64,64,0,GL_RGB, GL_FLOAT,array);

[This message has been edited by roffe (edited 05-05-2003).]

You can have many dependent texture reads on the R9700 too, as long as they aren’t dependent on each other. That is, doing something like tex(tex(tex(tex(tex(texCoord)))) only works to 4 levels, but doing
s = tex(texCoord + a);
t = tex(texCoord + b);
u = tex(texCoord + c);
v = tex(texCoord + d);

should work up to 31 texture lookups. Though, there is currently a driver bug (cat 3.2) that interprets independent texture lookups as dependent.

Originally posted by Humus:
Though, there is currently a driver bug (cat 3.2) that interprets independent texture lookups as dependent.

Ahh, no wonder! I thought I had completely misunderstood what “dependent” meant. This is a pretty serious bug…how long do you think we’ll have to wait for a fix?

Well, this bug affected some of my work while I was at ATi, and I reported it then. I don’t know how high its prioritized, but I see an improvement between cat 3.2 and newer drivers, so they are obviously working on it, though it’s still not completely fixed. You may be able to dodge the problem in the meantime by reordering instructions.

Single-component 32-bit floating point textures and dual-component 16-bit floating point textures (1D, 2D, 3D, and cubemap) can be emulated (including RTT) with the PACK and UNPACK instructions.

Essentially, create a standard RGBA texture, and

  1. if you are using this for RTT, bind it as a render target and use

UP4UB o[COLR], RCOMPONENT;

for 1*fp32 textures, and

PK2H R0.x, TWOHCOMPONENTS;
UP4UB o[COLR], R0.x;

for 2*fp16 textures.

  1. if you are on a CPU, cast the memory pointer to a float* or half*, and write out the bytes directly.

Then, when reading the texture in a fragment shader, use:

TEX RREGISTER, TEXCOORD, FAKEFPTEX, TARGET;
PK4UB RREGISTER.x, RREGISTER;

for a 1*fp32 texture, and:

TEX RREGISTER, TEXCOORD, FAKEFPTEX, TARGET;
PK4UB RREGISTER.x, RREGISTER;
UP2H RREGISTER.xy, RREGISTER.x;

for 2*fp16 textures