PDA

View Full Version : 3D Textures+Cg



Lysis
08-12-2004, 10:01 AM
I'm using 3D textures extensions in opengl to render a volumetric data, and would like to use vertex shaders for lighting. Problem is, when programmable vertex shaders are enabled the 3D textures basically stop functioning. Now I assume I need to replicate some of the fixed function 3d texture functionality in my vertex program, but I can't seem to crack this one. Anyone have any ideas?

Part of whats so tricky is I need the final stuff to work on a GeForce 4 icon_sad.gif, so I the vertex/pixel shaders have to be fairly simple. I'm using Cg at the moment, but really just an explanation of how to recreate the fixed function vertex pipeline for 3d textures is all I really need... Thanks

dorbie
08-12-2004, 10:12 AM
How are you generating the texture coords? If sending as per vertex texcoords just pass them through, if using texgen you'll have to implement the appropriate texgen from the available plane equations in the vertex shaders and send the results through.

Lysis
08-13-2004, 02:43 AM
Well there are per vertex texture coordinates (assigned using glTexCoord3f) but passing them through doesn't seem to be working (object doesn't show up)

Is below what you mean? (with Tex0 being TEXCOORD0, Tex1 TEXCOORD1, etc in Cg)

OUT.Tex0=IN.Tex0;
OUT.Tex1=IN.Tex1;
OUT.Tex2=IN.Tex2;
OUT.Tex3=IN.Tex3;