Terrain support in Panda?

What kind of terrain support does Panda include? I know I cringe when anyone asks this about a 3D engine. :slight_smile: I don’t need infinite terrains (i.e. no MMPOGs) but I do need something that is a few miles square. Does it support heightmap based terrains, or only meshes created in modelling apps?


It’s a little tricky to make a procedural heightfield.

The easiest way is to pre-create a 3D model of a 64x64 flat grid, and store it as a BAM. Then, after loading it, procedurally modify the Z coordinates of the vertices. You can put together a patch-based terrain grid using several patches loaded and modified in this way. You could even do some sort of geomipmapping if you have a couple different BAMs of different resolutions.

For texturing, you have to procedurally generate a texture. It’s easy enough to load a texture from a file and assign it to a patch. I’m sure there’s a way to load a texture from a block of bytes, instead of from disk.

Unfortunately, I do not know the APIs for any of this (I’m a little new to panda). I would look at the GeomNode.h methods to see how to modify the vertices of an already-loaded model. I would look at the classes texture and pixelbuffer to figure out how to procedurally generate the terrain texture.

It’s also possible to generate geometry from scratch. The “egg” API is the published way to do this. Maya2egg is really just a panda program that procedurally generates a scene graph from whole cloth, then dumps it out to disk.

We really need to write a manual page on procedurally generating geometry. In fact, I’m going to go put a stub in the manual right now. That will remind me to write it later.

Sorry - I’m a bit confused by procedural heightfields. Aren’t they different from 256x256 greyscale bitmaps? Hmm, maybe I meant to say a heightmap!!! :blush:

Not sure what you want to know.

If what you want to do is create a 256x256 greyscale bitmap, and then turn that into a 3D model of a terrain, then panda doesn’t contain a function to do that built-in.

The easiest way to do it would be to create a model of a 256x256 perfectly flat terrain in 3D studio Max. Load it. Then, write a subroutine to change the Z-coordinate of every vertex.

If you want to store the raw data in an image file format, then I suppose you would have to load the grayscale image file (you can use panda’s bitmap loading functions), then loop over all the pixels, transferring the greyscale color value to the Z-value of your terrain model.

The only problem with this is that loading a 256x256 model is slow. That’s a lot of vertices. So I’d break it up into patches - maybe do a 64x64 terrain.

Stodge, I’m confused as well. I’m still trying to decide whether to go with Panda or stick with the Torque Game Engine myself. I’m having a hard time figuring out how to put a game together in Panda. The tutorials are great, but I haven’t seen the functionality in any of them yet that I’m looking for. In Torque, the terrain can be generated with heightmaps and then you can hit a function key while playing the game to modify the heights (move up down etc) the way you want. You can also enter an editor that allows you to place a static mesh, setup spawn locations etc… Can you enter/exit buildings without pause (you can’t in ToonTown).

I’m sure Panda has the capabilities (I’m hoping) I just hate to keep bothering everyone on these boards with “How do you do this? Can Panda do that?” questions.

With Torque, someone published a book so most of it was explained there.

I’m hoping it comes to me in my sleep one of these nights :slight_smile:

Can you enter/exit buildings without pause (you can’t in ToonTown).

Yeah, I have to say this was one of the things that p***ed me off with ToonTown.

Torque looks pretty interesting. Not much use for OpenSource/GPL projects of course. That said, GPL is somewhat over-rated I have to say, so it’s certainly tempting.


Sorry the Toontown doors are so annoying. :slight_smile: They work they way they do because of certain game design decisions we made. But that’s nothing to do with Panda; you can certainly design doors in Panda that don’t iris in and out when you walk through them.

But to be honest, if your goal is to do one of the standard genre games, you probably will find it easier to use an engine like Torque, which will have many of the features you need already pre-canned for you.

Panda doesn’t have so many standard game features already done for you; you’ll have to do them yourself. What Panda gives you is a framework that makes it easy to do general 3-D design, rather than a kit of parts for standard 3-D games. That makes Panda a better choice if you want to do something new and unique.

Great news on the plan to add this to the manual. I eagerly await it!

The method Josh mentioned is exactly what I’ve planned to do for my terrain. I have not figured out how to do it yet, though =)

In the other forum, Witchetty came up with what I think is a very good idea - write some game templates for standard game types. This is exactly the sort of thing that could fill the gap here. For example, if we had a game template for a flight simulator that happens to use a heightmap terrain, then you would be able to dig into the template, see how it works, and maybe even cut-and-paste the heightmap terrain into your own code.

I think this is a great compromise. Also, it’s exactly the sort of thing that students at the ETC could reasonably do. This is going onto my todo list for sure.

I already own a license for Torque, and yes it’s a great product but not it’s not under the GPL (wasn’t sure if hughperkins thought this or not).

At the moment I just want to prototype some ideas for a non-FPS two player turn based strategy game. I love Python, though I’m still a beginner. I’m tired of messing with compilers and C++ and I just want the easy life. Hence the reason I’m here. :smiley:

Panda3D seems to provide most of the features I need, except the heightmap. THough I guess that could be created using a modelling app. I’m not sure about its performance capabilities yet, though the requirements are lower than usual for my prototype due to the type of game. I would need to still push polygons around though, so time may tell!

David, I’m definately not trying to knock Panda. I’m sure I’m one of many who really do appreciate the work Disney VR and ETC have done with Panda.

I am finding it hard to duplicate what I can do in Torque with Panda, just because I don’t know yet how to do it the Panda way. Josh, standard genre type (e.g. FPS) templates would go a long way in attracting others like myself to Panda. I think for me, I’d be willing to invest the time with Panda if I know it could accomplish some of the things I can do with Torque, without C++ coding that is. Like David said, the Torque stuff is already done for you as far as the implementation details. You just script the game with TorqueScript and if you really needed something done that it can’t do out of the box you’ll need to hit the C++.

The doors thing in ToonTown wasn’t a pain for me, just let me to believe there was a limitation in Panda. I didn’t know it was a design decision.

The Python is the biggest attraction for me.

re: Toontown. Hey, I just played the beta. Probably doors in the release worked great :astonished:


No offense taken, of course. :slight_smile: Well-intentioned criticism of any product, Panda or Toontown or anything else, doors included, is always welcome.