Defensive structure stretching
Posted: 09 Nov 2010, 20:12
While Berg is working on adding proper foundations to current models (stretched dynamically to fit terrain), I am working on tweaking the code that is doing the stretching.
The current code produces results like this: It looks at the corners of the building's tile to find the height of the structure, then pulls the vertices below zero height in the model down to match the terrain.
I changed it so that it tries to find its new height based on the points where the model would intersect with the ground, instead of looking at the tile's corners. For smaller models, this seems to give a clear improvement on uneven terrain: Next up is to try to figure out a better way to stretch. Currently models are neatly adapted to the terrain geometry underneath, which produces uneven stretching in the model. Like this: I tried instead to pull every vertex below zero height down to the same common denominator, to make the stretching even: However, as you can see, the result is somewhat ambiguous. While the stretching is cleaner, the transition-to-ground part of the texture is now mostly underground, causing an abrupt and bad looking transition.
If you have some suggestions on how to improve this, please speak out
The current code produces results like this: It looks at the corners of the building's tile to find the height of the structure, then pulls the vertices below zero height in the model down to match the terrain.
I changed it so that it tries to find its new height based on the points where the model would intersect with the ground, instead of looking at the tile's corners. For smaller models, this seems to give a clear improvement on uneven terrain: Next up is to try to figure out a better way to stretch. Currently models are neatly adapted to the terrain geometry underneath, which produces uneven stretching in the model. Like this: I tried instead to pull every vertex below zero height down to the same common denominator, to make the stretching even: However, as you can see, the result is somewhat ambiguous. While the stretching is cleaner, the transition-to-ground part of the texture is now mostly underground, causing an abrupt and bad looking transition.
If you have some suggestions on how to improve this, please speak out