# Procedure generating terrain...

Josh Y.,

You mentioned in a post a while back that it was possible to simulate terrain by procedurally generating it. I’m trying to understand what you mean exactly.

Currently in Panda3d you build a large mesh to be your terrain and you just point a camera at it and place your actor inside.

I’m thinking by procedurally generating your terrain your saying something like…create a large flat mesh and then with script maninpulate the mesh (raise up/down etc) to produce your terrain as needed.

Is this what you mean? Or is it something else.

Please forgive my ignorance of the topic.

Thanks,

Steve

p.s. Josh, I’m not asking you to write this, I just would like to know a little more detail so I can explore it on my own.

IPKnightly,

Thanks for taking the time to write this up.

I was asking Josh just because he/I had a post a while back before 1.1 regarding terrains and such.

I saw the part in the manual about procedurally generating geometry but just couldn’t understand it really.

Steve

I guess I’m still kind of confused about this whole subject. Its one of the reasons I haven’t been working on Panda3d in a while.

If Panda3d doesn’t generate the terrain for you, what purpose is reading a heightmap? This is what I know about heightmaps… they are a greyscale image where the lighter colors are higher elevations than the darker areas. So the lighter areas should tell you where the up (Z or Y) vertices are.

Seems like I have a lot to learn.

Signed,

AlwaysConfusedWith3D

Hey, those were good articles!

Thanks again,

Steve

First of all, sorry I’m not responding promptly - I’m in a hotel, on a trip.

Anyhow, panda 1.1 has a convenient set of routines for creating an empty mesh, and then adding vertices and polygons one by one (from within code). You can see this API demonstrated in the “procedural geometry” demo programs.

Using this API, it’s not very hard to write a subroutine that converts an array of elevations into a GeomNode. We really ought to provide this subroutine, it’s such a common thing to want to do, I just haven’t gotten around to writing it.

Hi Josh,

Hey, that’s ok. I know your time is limited.