Is this possible?

First I must say this is a beatiful site, and panda3d looks great, but I’m not sure if it can fulfill my needs.

Let me describe the program I’m trying to build:

Anybody who has played simcity 4 is familiar with the terrain tools. Basically, there is a blank flat landscape, and you have the ability to ‘terraform’ it in-game, modifying the landscape with things like mountains. However, you can only terraform individual cities one at a time. Very boring…

The game supports the rendering of indexed colour or greyscale images into terrain, so this means that it may possible to build a terrain with similar tools in a spiffy panda3d opengl environment, convert the terrain to a greyscale image, and then import that into the game. It would use things like a fractal generator to create things like mountains or lakes. And you could select textures to ‘preview’ a region before a time consuming in-game render.

I’m an expert in python, but have very little experience with 3d graphics. How difficult would it be to:

  1. Import a greyscale landscape into a panda3d opengl environment
  2. Modify the landscape in real time (and create the terrain tools to do this)
  3. Export that as some kind of greyscale image, where darker pixels correspond to lower heights.

I’m looking to build something like this, excect much more capable:

Any help would be much appreciated :slight_smile:

PS - if this is not possible, are there other libraries with python bindings that might be? I have looked into soya3d, but it feels a bit limiting.

Panda 1.1 (coming out shortly) should have support for offset bumpmaps, which sounds like the technique you’re trying to use. As for loading grayscale images, the easiest way is to load them into a Texture, and then use the PNMImage class to look at individual pixels. For Example:


#....manipulate the image use the PNMImage class
# and now put it back on the texture


#you can now apply the texture to any geometry

Look at the section in the manual about textures. As for PNMImage, you’ll have to go to the API but its pretty straightfoward.

Also, if you just want to do offline image-manipulation without necessarily applying your image to geometry, you can use the PNMImage class to read and write image files directly without having to go through the Texture interface.


Thanks for the responses! I’ll have to have a better look at the panda3d api

So, from what I understand, this is doable? I’m not really familiar with bumpmapping, but I think that has more to do with shading (which might be usefull later for lighting realism)

kmensah is not referring to bumpmapping as such; by “offset bumpmaps” he means the generation of terrain geometry based on a height field defined in an image file. Both will be possible in the upcoming 1.1 version (though you’ll have to write some code to do it).


Write code in Python or in C++?

Python, no worries. :slight_smile:


Any chance of a guesstimate for the ETA for 1.1? 8)

Right now my honest guess (and it’s just a guess) is maybe 3-5 weeks. All of the core features are in and working, but there are several little things that are demanding attention, and it will probably take a handful of weeks to sort them all out and package up the release.

Of course, the truly bleeding-edge developer–especially one who’s already had experience compiling Panda3D–can get the current version directly from the CVS repository and poke around with the new features immediately. It might be tricky to do a lot of poking without the matching documentation, though. :slight_smile:


I can’t wait!

There’s CVS?

Should be

I looked but it didn’t look like there had been any updates for a long time.

We check in updates to CVS daily.