PDA

View Full Version : 3d floating point textures on nvidia...



graphicsMan
05-04-2003, 07:41 PM
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:

[CODE]
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

jra101
05-04-2003, 07:48 PM
Floating point textures are restricted to the TEXTURE_RECTANGLE_NV texture target with the GL_NV_float_buffer extension.

graphicsMan
05-04-2003, 07:55 PM
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

Zeno
05-04-2003, 08:32 PM
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. http://www.opengl.org/discussion_boards/ubb/smile.gif

-- Zeno

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

graphicsMan
05-04-2003, 09:44 PM
Originally posted by Zeno:
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. http://www.opengl.org/discussion_boards/ubb/smile.gif
(edited 05-04-2003).]

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 http://www.opengl.org/discussion_boards/ubb/frown.gif

I guess I'll just have to wait until the next round of cards comes out...

Brian

JustHanging
05-04-2003, 10:02 PM
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

Zeno
05-04-2003, 10:12 PM
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 http://www.opengl.org/discussion_boards/ubb/frown.gif.

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

roffe
05-04-2003, 11:09 PM
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).]

Humus
05-05-2003, 05:50 AM
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.

Zeno
05-05-2003, 07:53 AM
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?

Humus
05-05-2003, 08:22 AM
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.

gking
05-05-2003, 01:46 PM
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.

2) 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