Grid heightmap with clifffaces

Started by
3 comments, last by Ussyless 10 years, 11 months ago

Greetings, i'm working on a small project, and i want to be able to create a heightmap with cliff faces

rather than trying to explain it, i've made a diagram

MkVz16w.png

so basically, edges of the heightmap could de-sow from each other and go up into a cliff, or down into a canyon, maintaining a hard edge

diagonal edges are not important

i had some ideas of my own suck as

each tile contains 4 points of data, rather than one per grid point, this method isn't ideal as it would be difficult to tell what is sewn to what, and be able to edit map/create movement on the map effectively, aswell as using 4 times the memory

each grid point would instead contain say 3 or 4 possible heights, i could de-anchor the terrain from one point, and anchor it to a new point which i could move up or down to edit (or have a dynamic amount of heights stored in each point, changing for the situation)

anyway, i was wondering if anyone had any better ideas for my problem?

the project will be a stratergy game, buildings, units etc, so collision mesh type things aren't realistic

Advertisement

In my days as a heightmap-engine enthusiast, I came to realize that there are two potential routes.. One route entails allowing heightmap points to have XYZ offsets from their default position - whereas normally they would only have a vertical offset from their default position. This would allow you to take the points at the top of a slope and shift them to be directly over their corresponding points on the 'ground' that are below them. Also, you could move the ground points closer to the cliff points above to be directly underneath, or shift them both toward eachother.

The other option involves allowing a grid point to 'detach' from the grid, as in your first image, which requires that it create new polygons to re-connect it to the faces it detatched from (to form the actual cliff/canyon faces). You will have to detect whenever there are multiple detached points, that are connected together, say, forming the edge of a cliff, and then generate the new faces to form the cliff/canyon faces.

The first option is easiest to implement, and works well within almost any existing heightmap setup by just adding in the extra axis offsets to each heightmap point.

The second option would have a more polygonal look to it, depending on how coarse/fine your heightmap grid is. It also might get tricky dealing with any sort of LOD system (does anybody use LOD on their base terrain meshes anymore, or is everyone just brute forcing them these days?)

possible problem with offsetting along x/y would be, being a strategy project, unit/building placement would also be confined to the grid, aswell as collisions, and movements, would look warped if units walked over height map area with points moved along x/y plane

I haven't ever tried to do a heightmap with cliffs as in your first image, but thinking about it it seems like you could just generate a heightmap as in the second image then go through and mark certain edges as cliffs. These edges would be analyzed according to other cliff edges they connect to, analyzed according to the heights of edges that lie opposite their connected faces (to determine which side the cliff faces) and then their connecting geometry re-built according to templates corresponding to edge patterns. It would be a bit messy, and you would want to figure out some custom structures for aiding in your analysis of edge patterns for efficiency, The scheme would further be complicated if you construct the terrain out of triangles, and allow diagonal edges to be marked as cliff edges, since that would just add more cases and more specialized geometry re-constructions.

Note that in a scheme like this, building the geometry is only part of the battle. Once you have stitched-together your cliffs and heightmap, you would then have the task of texturing it. You wouldn't be able to use a standard heightmap texturing scheme anymore, since the vertical faces would show incorrect mapping. In that case, you would need to switch to an alternative means of texturing: maybe snip out the vertical faces and draw them as separate geometry with another material, or possibly use a technique such as the tri-planar texture mapping demonstrated by an NVidia demo here.

An alternative approach is to continue doing the heightmap in the standard fashion, then construct separate geometry to act as a cliff overlay super-imposed upon the terrain. This overlay would line up with the cliff segments to hide the steep slope. However, this method would require either rigid constraints on the geometry of the slope underlying the cliff, or some sort of procedural method to re-shape the cliff geometry according to the terrain upon which it sits.

UV mapping shouldnt be a problem, it will most likely be flat colors for terrain with shading, atleast for now

anyway, i'll try something over the next couple days and hopefully post results back

This topic is closed to new replies.

Advertisement