multiple texture coordinates

It looks like to me that the orginal texture coords of an egg file are loaded into the geomObj->vertexData. But where do the extra sets of texture coords go when you create multiple TextureStages?

Right now I am multitexturing a standard 2d texture with a 3d texture, and I would like to manually change the <u,v,w> coordinates to the 2nd texture stage (the 3d texture).

Any ideas how I can get access to texture coordinates from different texture stages?

Thanks for the help

A GeomVertexData can store any number of different sets of texture coordinates, each with a different name.

If you are using one of the setTexGen() modes to generate 3-d texture coordinates, then the name doesn’t matter; the texture coordinates are a direct property of the TextureStage. See the Panda3D manual for more on this.

If you want to generate 3-d texture coordinates by hand, you can put them in the egg file with syntax something like this:

<UV> myName { 0 0 0 }

Then you tell your TextureStage to use your named coordinate set like this:


If you want to generate a particular named texture coordinate set on-the-fly using the GeomVertexWriter, then you will need to create a custom GeomVertexFormat that includes an extra column for your named texture coordinates (instead of using one of the standard GeomVertexFormats). Use InternalName.getTexcoordName(‘myName’) as the name of this new column. This will also be the name that you pass to GeomVertexWriter to fill in the data for this column.


Seems like alot of work just to define a set of texture coordinates for a group of vertices…

Does anyone have an example where they generate a second set of texture coordinates on the fly?


Generating or modifying geometry on the fly is a lot of work. We have provided tools to make the common cases easier, but you just wandered into a less common case.

Still, it’s not that much more work than modifying the default texture coordinates. There’s really just one more step, that of defining your own custom GeomVertexFormat.