terrain

Return to General Discussion

terrain

Postby samusam » Wed Feb 08, 2012 12:43 pm

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
samusam
 
Posts: 57
Joined: Sat Aug 20, 2011 11:11 am

Postby rdb » Wed Feb 08, 2012 1:34 pm

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.
rdb
 
Posts: 8575
Joined: Mon Dec 04, 2006 5:58 am
Location: Netherlands

Postby samusam » Wed Feb 08, 2012 3:11 pm

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)
samusam
 
Posts: 57
Joined: Sat Aug 20, 2011 11:11 am

Postby rdb » Wed Feb 08, 2012 3:30 pm

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.
rdb
 
Posts: 8575
Joined: Mon Dec 04, 2006 5:58 am
Location: Netherlands

Postby flavio » Wed Feb 08, 2012 4:43 pm

If you are a Blender guy, you can also consider this approach.
Image - Image
User avatar
flavio
 
Posts: 530
Joined: Fri Apr 16, 2010 12:45 pm
Location: Rome, Italy

Postby samusam » Sat Feb 11, 2012 9:31 am

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.
samusam
 
Posts: 57
Joined: Sat Aug 20, 2011 11:11 am

Postby rdb » Sat Feb 11, 2012 3:11 pm

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.
rdb
 
Posts: 8575
Joined: Mon Dec 04, 2006 5:58 am
Location: Netherlands

Postby samusam » Sun Feb 12, 2012 10:39 am

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 http://www.panda3d.org/manual/index.php/GeoMipTerrain
dynamic terrain.
Tnks
Samuele
samusam
 
Posts: 57
Joined: Sat Aug 20, 2011 11:11 am

Postby rdb » Sun Feb 12, 2012 4:22 pm

Ah, that must have been a typo, apologies. I've corrected the manual page.
rdb
 
Posts: 8575
Joined: Mon Dec 04, 2006 5:58 am
Location: Netherlands

Postby samusam » Mon Feb 13, 2012 4:52 am

8) :lol:
samusam
 
Posts: 57
Joined: Sat Aug 20, 2011 11:11 am


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 2 guests