terrain

Hi, I want to understand the terrain panda3d. I had thought to generate a terrain OBJ files, but in the manual I read that there are generators of terrain panda3d with the applicable attributes. I ask if I can use the terrain as a 3D model (obj) and then applied to to the terrain properties using code. Properties such as or similar to GeoMipTerrain or HeightfieldTesselator.

Hi,
Samuele

No, you will need to create a heightmap for your terrain, either by creating your terrain in a terrain editor that can export heightmaps or by converting your mesh into a heightfield image.

Thanks, now I have a better idea. Another information: what are the extension of these files (question asked to orient myself in the software that generates maps)

Usually grayscale .png files are used. Usually 8-bits or 16-bits, depending on the required precision.

If you need any suggestions for tools you can use, Terragen is a popular tool that is widely used to generate pretty realistic results, although I’ve never used it myself. There is also L3DT for generating pretty convincing large terrains based on erosion simulations, including climate-specific texture maps, or EarthSculptor if you prefer to sculpt your terrain completely manually.
All of these are Windows-only programs, unfortunately, but L3DT seems to work great in wine.

Of course, if you just want something simple, you could also use your favourite image editor to generate a perlin noise image, which should create some decent-looking hills.

If you are a Blender guy, you can also consider this approach.

because the terrain is inserted without texture and relief? I follow the code of the manual:

terrain = new GeoMipTerrain(“mySimpleTerrain”);
terrain->set_heightfield(Filename("/c/Users/Samuele grafica/Desktop/terreni/testterreno.png"));
terrain->set_bruteforce(true);
terrain->get_root().reparent_to(window->get_render());
terrain->set_min_level(2);
// Set terrain properties
terrain->set_block_size(32);
terrain->set_near(4);
terrain->set_far(100);
terrain->set_focal_point(camera);
//terrain->get_root().set_sz(100);
// Store the root NodePath for convenience
NodePath NodoTerreno = terrain->get_root();
NodoTerreno.reparent_to(window->get_render());
NodoTerreno.set_z(1000);
NodoTerreno.set_pos(-1000,-100,0);

terrain->generate();

//inserimento di un punto luce

// Add a task to keep updating the terrain

taskMgr->add(new GenericAsyncTask(“Updates terrain”, &UpdateTerrain, (void*) NULL));

// This is the first part of the main
AsyncTask::DoneStatus UpdateTerrain(GenericAsyncTask* task, void* data)
{
terrain->update();
return AsyncTask::DS_cont;
}

I tried changing some parameter, but the result is the same.

You have to call set_sz to set the vertical scale of the terrain. You didn’t apply a texture, so no texture will show up until you apply one with set_texture.

You’re right. I’m confused because the manual says to use root.set_sz (100), but then in the example code puts root.set_z (100);

in panda3d.org/manual/index.php/GeoMipTerrain
dynamic terrain.
Tnks
Samuele

Ah, that must have been a typo, apologies. I’ve corrected the manual page.

8) :laughing: