Skip to main content
GameDev.net gamedev.net
🔒 Locked

Best performing LoD algorithm

Started by DanielH Aug 7, 2006 at 12:09 AM 13 replies 6.1k views
Original Post
DanielH
DanielH
I need a good dynamic LoD algorithm to use in a terrain editor. Gotta be dynamic since nothing is constant in my world :P Another thing I'm interested to learn more about is how to implement decals on a terrain that change its LoD. [Edited by - DanielH on August 7, 2006 12:42:28 AM]
PhilMorton
PhilMorton
Whats a "deals"?

Try out the ROAM algorithm if you want a good starting point. Lots of other algorithms were inspired by ROAM so it will do you good to understand how it works before moving on to more complex ones like SOAR...

http://www.llnl.gov/graphics/ROAM/
Allways question authority......unless you're on GameDev.net, then it will hurt your rating very badly so just shut the fuck up.
DanielH
DanielH
Long time since I read about ROAM, but doesn't that rely on precomputed error data? Since it's an editor it will be kinda hard to use that algo. Perhaps I'm wrong though. Also, my terrain is already built in a quadtree. Each patch is 33x33 vertices.
paul_nicholls
paul_nicholls
Quote:
Original post by DanielH
I need a good dynamic LoD algorithm to use in a terrain editor. Gotta be dynamic since nothing is constant in my world :P Another thing I'm interested to learn more about is how to implement deals on a terrain that change its LoD.


Do you mean decals instead of deals?

Paul.
DanielH
DanielH
I also want to add that my editor is using multiple viewports. I suppose that totally eliminates the possibility to use ROAM since it would mean I have to store a binary triangle tree for each viewport? Perhaps I'm wrong aout that aswell, I don't really know. Perhaps every kind of LoD algo will force me to keep some kind of data structure for each viewport?
JohnBolton
JohnBolton
I'm not sure why people continue to recommend using ROAM. In general, it is rarely the best choice. The major disadvantage of ROAM is that you have to use dynamic vertex buffers and rebuild them ever frame. However, in your case, if the terrain is changing every frame, you would have to do that anyway, so maybe it isn't a bad suggestion.

If your terrain geometry doesn't change much, then an algorithm that uses static buffers is usually a better choice. You mentioned that your terrain data is in a quadtree structure, so chunked LOD might be the best choice because it is based on quadtrees. However, geomipmapping is easier to implement.

You will probably have to store some state information per view regardless of the algorithm, but I don't think that will be a problem.
John BoltonLocomotive Games (THQ)Current Project: Destroy All Humans (Wii). IN STORES NOW!
DanielH
DanielH
I wouldn't say my terrain is that dynamic, thal it'll change every frame. The vertex buffer only updates when the terrain is raised and lowered by the user. Most of the time it's just a static mesh. Is there any good resources on chunk lod and geomipmapping?
DanielH
DanielH
I've spent several hours now reading on vterrain.org. I think that geomipmapping will be the best choice for this project. SOAR seems nice aswell, but since I already have my quadtree up and running I feel it's easier to go with the more simple technique mipmapping. One thing I wonder is how, or if it's possible to generate a single trianglestrip for a patch. I don't want to use a trianglestrip + one trianglefan for each side that has a LoD differance. Anyone solevd this before?
coelurus
coelurus
Degenerate triangles, duplicate a couple of vertices to make zero-area triangles and adjust the strip until you're on the next row. A tip is to flip the diagonal ("hypothenuse" if the triangles are projected straight down and you got a uniform grid) of the triangles for every new row, the terrain looks funky if all diagonals point in the same direction.
DanielH
DanielH
Quote:
Original post by coelurus
Degenerate triangles, duplicate a couple of vertices to make zero-area triangles and adjust the strip until you're on the next row. A tip is to flip the diagonal ("hypothenuse" if the triangles are projected straight down and you got a uniform grid) of the triangles for every new row, the terrain looks funky if all diagonals point in the same direction.


Sounds pretty much what I'm doing right now without any LoD algo. But since i need to lower the LoD level on the edges that borders to lower lod level patches I need to figure out some nice little formula to generate a single tri-strip for the whole patch. I don't want to hardcode all 17 diffrent setups ;)
JasonBlochowiak
JasonBlochowiak
ROAM is, indeed, not relevant for modern hardware.

As for decals, it depends on what your needs and setup are.

If you only care about diffuse decals, you can have your standard diffuse texture for your terrain, and have a decal texture that you "splat" your decals into, and then blend between the two layers when rendering your terrain. That has the advantage of no cracking, etc. It has the disadvantage of potentially burning memory access and texture RAM.

There are lots of approaches - again, it depends on exactly what you're trying to do.
DanielH
DanielH
Currently I'm extracting the heightmap area that touches the decal area. Then I'm building an indexed buffer and construct a texture matrix. Then I just draw the indexed tri-strip with the texture clamped. Works like a charm, but it will look horrible if the terrain isn't synched with the same LoD level as the decal mesh.
JasonBlochowiak
JasonBlochowiak
Quote:
Original post by DanielH
Currently I'm extracting the heightmap area that touches the decal area. Then I'm building an indexed buffer and construct a texture matrix. Then I just draw the indexed tri-strip with the texture clamped. Works like a charm, but it will look horrible if the terrain isn't synched with the same LoD level as the decal mesh.


Yes, that approach would require that you rebuild or discard your decal when the LOD changes, or accept that it doesn't look the best under those circumstances.

Again, it depends on what you're trying to do. Are you going to have a few decals? A lot of decals? Are you going to try to make them shiny (specularity)? Have bump mapping? Have apparent depth (e.g. parallax mapping)? Do the decals need to persist for a long time? Are you going to want non-decal terrain effects?
DanielH
DanielH
What I want do do with the decals is to add tiretracks to the terrain and some kind of marks for where cars are positioned when a race start.
JasonBlochowiak
JasonBlochowiak
Quote:
Original post by DanielH
What I want do do with the decals is to add tiretracks to the terrain and some kind of marks for where cars are positioned when a race start.


Ah, ok.

You can either do the splatting type thing, or modify the original terrain texture (in which case you'd probably need to regenerate your mipmaps).

Or, you could simply discard the decals when they no longer match LODs.

Of course, what you do does still depend on how fancy you want to get - I mean, you could be doing parallax mapping on your tire tracks.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.