Blending Buildings and Roads with Terrain

Problems building or running the engine, queries about how to use features etc.
daves
Goblin
Posts: 214
Joined: Fri Jan 20, 2006 3:35 pm

Blending Buildings and Roads with Terrain

Post by daves »

I could just as easily have posted this question in the PLSM forum. I think its pertinent within this and the core Ogre Help forums.

To the extent that terrain is created using a heightmap and independently scene meshes (like roads) are created in a modeling tool such as max, how do people tackle the problem of blending these objects with terrain?

The problem I'm running into is how do you make a road or a buildings base show up on the terrain without any gaps? Assuming that the terrain itself is uneven.

What are the various tricks that people use to accomplish this kind of thing?
User avatar
HexiDave
OGRE Expert User
OGRE Expert User
Posts: 1538
Joined: Sat Jan 14, 2006 8:00 pm
x 1

Post by HexiDave »

I learned this trick from my time playing SWG: Normally you just have the bottom of the building flat at 0,0,0 - what SWG did was extend beyond that an extra couple feet. Essentially you're just adding more structure below the floor level just in case the terrain doesn't match.

Here's an example picture: Image

The 0,0,0 plane is right about where that notch in the metal is below the entrance - notice how everything extends well beyond that?


As for roads, someone made a curved road system that "hugged" the terrain to a degree. Here's the page: http://www.ogre3d.org/phpBB2/viewtopic. ... 772091f05e
daves
Goblin
Posts: 214
Joined: Fri Jan 20, 2006 3:35 pm

Post by daves »

I like your idea. I think that will work well with buildings... what about roads or runways... things that need to be flush with the surface?

Image

I dont want to give roads "too much depth". They need to be flush with the surface.

What are your ideas relative to this?
Rackle
Gnome
Posts: 375
Joined: Sat Jul 16, 2005 1:42 am
Location: Montreal

Post by Rackle »

Disclaimer: I've never done this, nor have I done much yet in the 3D world.

Thinking in technical terms, airplanes would want to land and take off on a level runway, not a runway that moves up and down. Thus the land under the runway needs to be terraformed; it needs to be made even. Either the terrain itself is edited and made even, or laying/placing a runway over an uneven terrain will even the terrain.
User avatar
Mikachu
Gnoll
Posts: 603
Joined: Thu Jul 28, 2005 4:11 pm
Location: Nice, France
x 35

Post by Mikachu »

I'm not 100% sure, but I think that when you build something in Warcraft3, there is a sort of auto-leveling of the terrain below, plus the technique described by HexiDave.
So, I think you could add a property for your buildings about if auto-leveling is required or not. For buildings needing it, like airports, you should also be careful to make it softly: the area strictly under the building is auto-leveled, and then a smooth transition to the not leveled terrain.
OgreProcedural - Procedural Geometry for Ogre3D
daves
Goblin
Posts: 214
Joined: Fri Jan 20, 2006 3:35 pm

Post by daves »

Thinking in technical terms, airplanes would want to land and take off on a level runway, not a runway that moves up and down. Thus the land under the runway needs to be terraformed; it needs to be made even. Either the terrain itself is edited and made even, or laying/placing a runway over an uneven terrain will even the terrain.
I'm not 100% sure, but I think that when you build something in Warcraft3, there is a sort of auto-leveling of the terrain below, plus the technique described by HexiDave.
So, I think you could add a property for your buildings about if auto-leveling is required or not. For buildings needing it, like airports, you should also be careful to make it softly: the area strictly under the building is auto-leveled, and then a smooth transition to the not leveled terrain.
Interesting...
Last edited by daves on Wed Nov 29, 2006 10:55 pm, edited 3 times in total.
daves
Goblin
Posts: 214
Joined: Fri Jan 20, 2006 3:35 pm

Post by daves »

Thanks for your thoughts. I am thinking (as a short term thing) that you are right and that I will morph (flatten) the terrain where I need to place specific objects (like roads). I would love to find out a more dynamic mechanism that might locally morph the terrain to match the objects that need to sit flatly on it.

Right now the terrain heightmap (through the PLSM) is managed separately from the scene objects that are instantiated in the terrain. Is it possible to bring the terrain heightmap into a tool such as 3DS Max (along with the scene objects that I'm already editing in 3DS Max) and morph it there (with the objects that are driving this morph there for the sake of reference- this way it would be less of a hit and miss kind of process)? Terrain morphed in this fashion would have to be output as an updated heightmap, run through the PLSM mapsplitter, assigned an appropriate offset and scale prior to loading into my application.

Though my question refers to PLSM and 3DS max I still think this is a pertinent question for the Ogre::Help forum, because it does relate to the overall mechanism with which the various bits of a scene to be rendered are integrated within the Ogre environment.
sklug
Gnoblar
Posts: 1
Joined: Mon May 08, 2006 3:37 am

Post by sklug »

As far as roads go, you can possibly use the new terrain decals that were just put into CVS. I haven't written up a wiki about how to use them yet, but will soon. Though I haven't tried to use them for roads yet.

sklug
User avatar
HexiDave
OGRE Expert User
OGRE Expert User
Posts: 1538
Joined: Sat Jan 14, 2006 8:00 pm
x 1

Post by HexiDave »

Well you can morph directly in PLSM2 - I haven't used it in a while since I've got my own terrain craziness going on, but I'm sure you could just use the morph function to flatten an area to a specific standard height across a page and PLSM2 spits that modified heightmap out and makes a copy of the old one.

If that doesn't work for you, just manually edit the page files you split with MapSplitter (note, this is for heightmap - you'd have to either adjust the original file before split or the other MapSplitter-produced files) and just flatten an area out (in Photoshop or GIMP or something) with a specific white-black color and smooth the edge.

The other thing SWG did was flatten the land that was REALLY crazy in some cases, which was just finding all the vertices in the area around the house and lowering them a certain amount, taking into account that all houses were placed in a grid fashion (to keep buildings from being on page-edges.)
User avatar
CaseyB
OGRE Contributor
OGRE Contributor
Posts: 1335
Joined: Sun Nov 20, 2005 2:42 pm
Location: Columbus, Ohio
x 3

Post by CaseyB »

daves wrote:Is it possible to bring the terrain heightmap into a tool such as 3DS Max (along with the scene objects that I'm already editing in 3DS Max) and morph it there (with the objects that are driving this morph there for the sake of reference- this way it would be less of a hit and miss kind of process)?
I believe that in the Professional version of oFusion you can use the PLSM and load in a heightmap. I have not played with that so I am not sure if the terrain is editable at that point, but I would think that it would be because there is the deformable command in the terrain.cfg file.
Image
Image