PDA

View Full Version : 3d texture in vertex shader



adamvanner
01-05-2007, 08:23 AM
Has anyone got 3d textures working in a vertex shader in glsl without apawling frame rates?

ive created a 3d texture which works fine in a GLSL frag prog and also works fine in a Cg vertex prog, but just not in GLSL vert progs without a 5 secs per frame refresh (although the visual results are actually correct).

im using GL_RGBA_FLOAT32_ATI to specify the texture array and have mag /min filter set to nearest.
are there any other texture formats i should be trying?

hardware wise, im getting the same results on a dual core athlon64(2gb) with two GeForce 7800 gtx's as i am on a quad opteron(4gb) with a Quadro 5500

Thanks in advance

Zengar
01-05-2007, 01:11 PM
According to Nvidia, only TEXTURE_2D is supported for vertex texture fetch on their boards. See http://developer.nvidia.com/object/using_vertex_textures.html

adamvanner
01-05-2007, 03:58 PM
Thanks, but GL_TEXTURE_3D certainly do work in both Cg and GLSL (to my surprise it has to be said!)- its just in GLSL it runs like a dead dog.

Its just strange since its the first time ive notcied any performance differences between Cg and GLSL, so if anyone knows of an example of GLSL using 3d tex in the vertex prog, thatd be great.

btw- I initially emulated 3d textures using 2d textures and array index offets, but when using the tri-linear interpolation in the shader, the performance hit is noticable (2-3 fps slower), so 3d textures would be preferable.

Zengar
01-05-2007, 04:57 PM
That is really puzzling, because GLSL on nvidia is compiled using the GG compiler :-/ 3D textures also should be supported in Direct3D. Maybe you should ask Nvidia directly.

Komat
01-06-2007, 04:35 AM
Use the NVemulate tool and enable writing of files with assembler generated by the GLSL compiler or alternatively run the standalone compiler with -oglsl option to compile your GLSL shader. You can compare that with output from the Gg compiler for the working shader to see what is the difference.

adamvanner
01-06-2007, 06:52 AM
Thanks guys! You'll need to slap me, tho... found why it was working so well in Cg... i was using the 3d tex in the frag shader! doh.