Advertisement Jump to content
  • Advertisement
  • entries
  • comments
  • views

Vertex morphing action

Sign in to follow this  


OK, I've added some stuff to the Land-o-Rama terrain engine. I've got some vertex morphing action. It's quite slow since I'm currently doing these calculations in software... for every friggin' vertex and normal. Here's how it works:

Each terrain patch can have its own morphing amount. This morphing amount is shared among all its vertices. At a given LOD, the morphing amount can range from 0.0 (finest) to 1.0 (coarsest). Four adjacent patches from the same LOD with a morphing amount of 1.0 (coarsest) can be seamlessly replaced by a single patch from the next coarser LOD with a morphing amount of 0.0 (finest), and vice versa.

This screenshot shows patches that are shaded according to the sum of its LOD and its morphing amount:

At first, it seemed easy to figure out the morphing amount for a patch. At any given LOD, just make the morph amount a linear blend between 0.0 and 1.0 based on its distance from the viewer. Unfortunately, as I looked closer, I noticed that this method has a serious flaw. Take a look at the patch outlined in red:

... morphs to ...

In the left image, this patch is about to be split into four patches. In the right image, the split occurs, but each patch has a different morphing amount because their distances from the viewer are not the same. This will appear as a noticable "pop" to the viewer.

To fix this problem, I changed the formula for determining the morphing amount. Instead of a linear blend between 0.0 and 1.0, I changed it to a linear blend between 0.0 and 2.0 and clamped the resulting amount to 1.0. This way, when a patch is close enough to the viewer to be split into four smaller patches, these patches are guaranteed to have a morphing amount of 1.0:

... morphs to ...

Now I wanted to see what the morphing looks like in 3D. I quickly hacked in some wireframe code that I stole from my original version of Land-o-Rama. I loaded a 3-arcsecond (90-meter) SRTM heightmap of the West Kootenay region of British Columbia (N49W118.hgt) and rendered it. Here's a screenshot of Elephant Mountain, just north of Nelson BC:

(This is a rendering of a 1024 x 1024 section of the original 1201 x 1201 height map. Land-o-Rama automatically applies artificial detail to the height map, resulting in a resolution of 32k x 32k. The patch size is 33 x 33.)

Moving around the heightmap, it appears that the vertex morphing is working correctly. You can see the vertices smoothly change when you get closer or farther away from a patch! However, there are big gaps between adjacent patches. This will be fixed soon.
Sign in to follow this  


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!