Geometrical MipMapping error

I need to make a terrain with dynamic texture.
I looked at the manual, and used this code:

Set up the GeoMipTerrain

terrain = GeoMipTerrain(“myDynamicTerrain”)

Set terrain properties


Store the root NodePath for convenience

root = terrain.getRoot()

Generate it.


Add a task to keep updating the terrain

taskMgr.add(terrain.update, “update”)

Here i have an error:

NameError: name ‘Filename’ is not defined.

What does this mean? I am really new to panda. Thanks

It means you need to import the Filename class from the panda3d libs. Add this to the top of your code:

from pandac.PandaModules import Filename

Yes it worked, thanks.

Now i need to colour that terrain. How can i do?

If you just want to set a plain color, you can do:

root.setColor(1, 0, 0)

for a red color or so. the colors are in R, G, B format, in the range 0-1.

But, most likely you want to set a texture on it instead of a plain color. For that, do:


where yourimg.jpg is a filename to your desired image you want on it.


And, for making different altitudes, (like blue -2, light blue -1, green 0, dark green 1, yellow 2, brown 3)?

The GeoMipTerrain does not provide an easy function for that. You can actually get different shades of a certain color for different altitudes easily by applying the heightmap as texture and using setColorScale, or, you can get the desired effect you want using a shader (which is complicated and expensive).

Still, I recommend taking your heightmap image, throwing it into some image editor (like photoshop or the GIMP), assigning different colors for different grayshades, then applying the result as a texture.

Actually, i need to put a terrain, apply texture to different colours (if the terrain is green then a texture, if it is blue another…) and make them of different altitudes ( the yellow part of the terrain must be taller than the green one…)

What is the best way?

Ah. That’s possible using a shader, there are various around at the forums, especially the one in the Nature Demo, which (I think) does what you want: