Newbie question concerning PNMImage or textures

OK, here’s the deal.

I’m working on a simple simulator for research purposes and just for fun I am trying to add some graphics to this. I’m planning to try and export my coordinates from Matlab/Simulink (where the simulator runs) and then use these to create a “camera image” from my vehicle. The simulator is too complicated to put entirely in Panda (would take far too much time), so that’s why I’m using this weird solution.

Anyway. I managed to import a heightmap with PGMM, but it’s all white (makes sense). I figure I have to add a texture or some color, but how does this work? I haven’t found any tutorials on this and like I said I don’t have the time right now to go too deep into the matters (although I am planning to do that in the future). Can anyone tell me the format a texture or color map should be in and how I can put it on my terrain? Maybe post an example file?

Thanks in advance!

The terrain root (which you can acquire using getRoot()) is a NodePath. You can treat it like you would treat any other nodepath, you can scale it around (thats what you’re also doing with setSz()), you can also apply textures on it like any other model.
For example:

root = terrain.getRoot()
root.setTexture(loader.loadTexture("yourTexture"))

You can use any texture scaling method you want as described in the manual.

OK, thanks! Let’s give that a try :slight_smile:

Probably I’ll need lighting aswell? Might as well just ask now. How do I add a light source?

I know, I’m being a complete idiot, but hey, gotta learn sometime :slight_smile:

Same like you would setup lighting on any other objects.
You can just setup lights for render or so and the terrain will be automatically lit as well, assuming you reparented the terrain to render.
panda3d.org/manual/index.php/Lighting

OK, thx!

This has been a lot of help for getting a quick start. It seems my idea just might work out :slight_smile: