Hey everyone, I’m very new into game development but I have strong backgrounds in scripting and some experience in 3d modeling, I want to take those two and build simple projects for a hobby I guess you could say.

Firstly, sorry if this has been answered anywhere, but I’ve searched for quite a while.

My question being, what’s the best way to build large expansive terrains? I’ve tried looking into the GeoMipTerrain but with it arise more questions, like how do I texture individual parts? How would I go about slightly modifying bits and pieces (like adding a cave for example)

I’ve considered making the terrain in different program, Blender, 3Ds Max maybe, but I want the LOD feature. Mostly what I’m asking for is a point in the right direction, I love tutorials but couldn’t find anything related.


Well, any project that involves dynamic LoD adjustment and multitexturing is unlikely to be “simple.” The manual has a good section on multitexturing, which is the way most professional games add detail to terrain. I haven’t actually used LoDs in Panda, certainly not for 3D, but spinning your own should be possible once you get comfortable making/importing/switching models. I couldn’t tell you if Panda has anything built-in to do terrain maps with automatic LoD management.

GeoMipMaps is heightfield style terrain system. This means that a 2d texture is used to generate the actual 3d geometry. Because a 2d height plane describes the terrain, you can only have slopes, no holes.

However, there are some ways around this. One engine I used allowed you to create “terrain holes,” which were specially-flagged quads on the terrain mesh that would simply not render. To build a cave, you would have a sloped hill, create some holes where you wanted the entrance to be, and then use static geometry to hide the discontinuity. (Such as a rocky cave mouth.) The only down side to this system is that the CLOD algorithm would cull the terrain quads flagged as holes when they were far enough away, so your entrances would visibly seal up.

You could also use alpha-mapped terrain texture that would signify a hole, but if you’re going to do multi-layer texture blending this becomes problematic.

By default you can apply a single texture to your GeoMipTerrain, and this texture will span the entire area of your terrain. Of course, this means the resolution will be quite low. One old way around this is to use a detail texture, which is just a high-frequency sampled noise that is blended with the terrain texture to give it bumpy noise when seen up close.

What is generally done now is to use multiple terrain textures and blend them based on an alpha map. This method is called texture splatting.

Assume you have four layers. Sand, dirt, grass, and then a rocky color texture. You generate a set of alpha maps for each type of texture. In each layer of alpha map you specify a value from 0…1, indicating the degree of how much that particular color texture will be applied. By repeating the color texture, you can generate a scaled-down pattern that will hold up better when the camera is close to the terrain. Combine this with normal-mapping or the detail texture that I mentioned earlier and you can get fairly good looking terrain for a modest number of texture passes.

As for very large terrains, a single GeoMipTerrains work pretty well for semi-large worlds in my tests. If you want a giant, continuous world you will need to use a hierarchy of GeoMipTerrains and blend their edges together. (In fact, there is a parameter for controlling this, called Border Stitching. Setting it to true will make all of the edges of your GeoMipTerrain render at the highest detail level. If your terrain heightmap edges all match, they blend together.)

It really depends on how much resolution you need. If your game universe won’t be hampered by gently sloping terrain and a lack of sharp features, you can stretch a single GeoMipTerrain to cover your entire projected play area.

Hope this helps!

Update: Oh yeah, for LOD. GeoMipTerrains contain a LOD system. Like the name suggests, it works much mipmapping does for texels. The GeoMipTerrain is made aware of your camera location and then it swaps detail levels on the fly. You can disable this if you want, which makes the GeoMipTerrain act much like the HeightfieldTesselerator, from what I understand.

Thank you both for the help, I’ll take this into consideration and see what I can come up with.

Also; Amazingly quick response, wish I could give you reputation or something.

Thanks again!

No problem, Edak. A lot of this is fresh on my mind, as I recently finished implementing a terrain texture shader with a GeoMipTerrain.

If you want to see a practical example of how to do multi-texturing with terrain, the YARR (Yet Another Roaming Ralph) example that’s floating around on the board contains such logic.

Here’s an example I wrote how to do multitexturing without shaders:

Of course there’s a texture stage limit by your shader, to go around that, call setShaderAuto - although that will only work well with the latest CVS version of Panda.

This is a great example, works great. However it for some reason has the effect as splut shaders of effectively setting setLightOff(). Why is it that all the terrain multitexturing methods remove the ability for the terrain to be effected by lights in the scene? I’d use a global shadow image but my application has multiple lights and many are dynamic, I’d end up with two or three thousand separate shadow maps for different conditions.

Eh, you’ll probably need to create a new stage that multiplies the result by CSPrimaryColor.

Or enable the shader generator, but you need latest 1.7 cvs for that.

Hmmm, perhaps I’m a complete moron but after an exhaustive search of the forums and the panda site I’ve found zero instructions as to where the cvs actually is. Lots of people saying “grab the cvs trunk” and whatnot, but no instructions how to do so. I found “a” cvs on the sourceforge page but it says this:

I’m a tad concerned this may not be current, given that the last comment was in 2001.

Am I a total idiot?

Wow, I don’t know where you saw that, but the last commit was today:

Info about the CVS repository can be found here:

maybe the cvs-link could be included on the download page, i think that would be the most logical place to have that, i already know that it’s on sourceforge, but without that knowledge i woudnt know where to look for it.

Good point, I’ll try to remember it when I make the 1.7.0 release.

Yeah, that caught me at first, too. Something seems to be up with the Sourceforge page… On the summary page it stats:

CVS browse code, statistics, last commit on 2001-04-18

But if you go to the stats page, you can clearly see that the tree is being maintained!

At first I thought I had stumbled upon an older repository, too.