PDA

View Full Version : terrain rendering with road and other buildings



victorswan
03-20-2003, 05:16 AM
I want to implement terrain rendering with road and other buildings put on it, by now the most popular terrain rendering algorithms are quadtree, ROAM , geomipmap or chunked lod and so on, but all these algorithms are all rendering only terrain, I wonder if I want to add road on the terrain, I mean the road is in the terrain and can connect with terrain seamlessly, what should I do, I am a green hand, I need help, and I hope some body can help me, thank you very very much in advance.
victorswan

JustHanging
03-20-2003, 08:07 AM
Hi,

I once tried to do this by using a quadtree, where each vertex is defined by an entire vector, not just by height. Then you can form nice roads by offsetting those vectors a little so that you get polygon edges match road's edge.

Technically there's nothing difficult about this, my problem was that I tried to automatically adjust the vertex positions based on the height- and colormaps, and it got a little complicated... Maybe you'll have better luck!

Houses shouldn't be a problem, if you want, you can use the same technique to align your terrain polygons with the houses too.

-Ilkka

Miguel_dup1
03-20-2003, 10:08 AM
It is not a difficult problem. For example in roam I use color maps and alpha maps for texture my terrain. I do it in one pass using the combine command. Now, you can have a second pass with the road, which is encoded in a road map per say.

If you want to see how I work with the maps and the blending, check out my code.
http://cheo.resnet.wayne.edu/miguel/

Regards,
Miguel Castillo



Originally posted by JustHanging:
Hi,

I once tried to do this by using a quadtree, where each vertex is defined by an entire vector, not just by height. Then you can form nice roads by offsetting those vectors a little so that you get polygon edges match road's edge.

Technically there's nothing difficult about this, my problem was that I tried to automatically adjust the vertex positions based on the height- and colormaps, and it got a little complicated... Maybe you'll have better luck!

Houses shouldn't be a problem, if you want, you can use the same technique to align your terrain polygons with the houses too.

-Ilkka

jwatte
03-20-2003, 10:55 AM
http://www.vterrain.org/ might be a more appropriate forum with better answers than an OpenGL specific forum such as this.

victorswan
03-20-2003, 11:37 PM
JustHanging, I think your method would be a good choice, would you like to show me some implementation code? thank you very much.

victorswan

JustHanging
03-21-2003, 02:58 AM
Trust me, you don't want that code. Imagine my first (and only) terrain renderer, where I've added every feature that's crossed my mind without ever doing any decent refactoring...

Here are some of my current thoughts about lodding a free-form (caverns, roads etc.) terrain:

Model your terrain in a modeling program, forget about heightmaps. Start from the lowest lod (least polygons, that is) and make it as simple as you can while still representing the shape it's supposed to. Avoid very large polygons (so that you can somehow insert them into a quadtree), but other than that use your polys freely.

From this start moving into higher levels of detail by subdividing all polygons and refining the new model to present new detail. Stuff like polysmooth can help you a lot here. Repeat until you have enough detail in your highest lod model.

Then insert all this into a quad/octree. Let the nodes overlap so that you don't have to split any polygons. Then make sure that on higher levels every polygon belongs under the same parent node as the lower lod polygon it's subdivided from. If you get this right, you should be able to do similar lod transistions and hole removal as with a heightmap-based quadtree.

-Ilkka

Miguel_dup1
03-21-2003, 05:37 AM
@ JustHang

Heightmaps is simply a way to encode the data you want to draw. For any ROAM or Quadtree implementation cares, you might be using a space shuttle to enocode your data as long as you feed in the right stuff at the right moment.

What you explained is how quadtrees and Roam works. Start from a big polygon and split it until you reach your desired detail. Nothing new here.

Now, about the caverns and road maps and so forth. You can enbed multiple grayscale heightmaps in one color heightmap. Say you have a 32 bit image, you can use each channel to be a different map!!!
You can use your primary color channel (call it red) to encode the default map, and the others to have stuff like road maps, water maps, and even caverns. http://www.opengl.org/discussion_boards/ubb/smile.gif

For caverns for example, you might want to use the difference between your default map and the cavern map to determine how deep or shallow the cavern is!

The one million dollar question is how you are going to feed this data to roam or any other implementation!!! How you are going to make the maps!!!


Miguel Castillo

[This message has been edited by mancha (edited 03-21-2003).]

victorswan
03-21-2003, 05:46 AM
Ilkka, thank you.
but my problem is more than I have mentioned, because the big part is the road, not the terrain, I do this for some people in transportation system, they can offer the real measured gemoetry data of both road and terrain,they are all the coordinates (x,y,z). for terrain, they can also offer DEM,that will be simple relatively, but there are some construct objects belong to the road, such as slope,culvert,drain and bridge,all these construct objects has no real data, only one coordinate and some parameters,such as height and width and some angles. they want me to split the road from terrain in real-time and dynamicly according to their design,so the road is not fixed to terrain, it must can be changed route interactively,besides this, they also want to walkthrough the road, so this is a virtual-reality together with some CAD system, rendering the large data terrain,at most can be hundreds of triangles, for walkthrough is not very easy, even if connect with road seamlessly, I think I really need some help.

Don't Disturb
03-21-2003, 07:46 AM
Just draw your road (and other objects) slightly above the terrain, and then draw a quad strip from the edges of the road down through the terrain, and then let the z-buffer worry about connecting the two.
However, it seems to me that a better solution would be for you to tell whoever you're working for that you're not up to the job.

JustHanging
03-22-2003, 02:42 AM
Ok, victor, looks like you've got a lot more problems that I thought. If the road is what matters, then maybe you might want to do it in a car-simulator way, drawing just a little bit terrain on the sides of the road. But I'm no expert here, just a thought.

Mancha, I know what a heightmap and quadtree is, I was just describing a general workflow to creating a large enviroment free from heightmap's restrictions, that can be efficently drawn with a good image and animation quality. Sorry if you got the wrong idea. And while I don't claim that I'm the only one who's come up with that, I still think it was useful and not-so-easy-to-find information. Key points were:
-Use a modeling program, working with multiple 2d maps is unintuitive and hard to implement.
-Start from lowest lod. It's the most critical part, and if you do it this way you ensure good lod transistions.

-Ilkka

victorswan
03-22-2003, 05:19 AM
thank you all above. I will try my best.