retreiving vertice positions

Is there a way to get the position of each vertice in a node? If so, could I apply a texture to each vertice or a bunch of vertices?

I’m trying to add a texture to it based on the vertice’s hight so I can automate the texturering of terrain.

Yes, you can walk through the vertices of a model and retrieve its x,y,z position. You could also change the color of the vertex based on its height, or change the u,v texture coordinate pair.

However, you can’t apply a texture to a particular vertex. A texture is applied to the whole object at once. All you can do is change the u,v for a particular vertex. You might, however, conceivably synthesize a texture so that when you apply it to the object, it has the color you want where that vertex is.

In any case, the Panda3D manual pages about generating procedural geometry talk about this a little bit (though those pages are a little weak right now). But the bottom line is, you need to get to the GeomVertexData class, which you can extract from the Geom, which you in turn extract from the GeomNode. Once you have the GeomVertexData, you can walk through the vertices with the GeomVertexReader, and you can modify the vertices with the GeomVertexWriter or GeomVertexRewriter.


Well… I dont think that would yield wonderfull results in the application I had in mind. I was thinking along the lines of vertex painting and so. But thanks for the help anyway!