Subdivide/triangulate with faces of equal area

Here’s a concept I’ve been thinking about. Suppose I want to create a cool 3d terrain. Suppose I want to use a height map that I previously created, or from actual GIS data or something. Typically I would add a mesh plane to my scene, subdivide it a few times, and then apply a displacement modifier with my heightmap.

If my heightmap had very little variation and was essentially flat or small rolling hills, the area of each of the faces in the mesh would be relatively equal. However, if there are faces that lie on very steep areas, like a cliff or canyon, I get faces that are stretched in the Z axis.

Suppose I apply an initial displacement (Z axis) to a lightly subdivided plane to get the rough layout of the terrain. Now I want to add more variety to my terrain, only this time I want to apply a displacement modifier normal to the mesh. I will get more detail where the verticies are closer together (the flat areas with smaller face surface area), and less detail or skewed features where the mesh faces are stretched up the side of a cliff.

Here are the solutions I can think of. After applying the initial subdivisions and displacement, subdivide it again and then decimate it or poly reduce it. The poly reducer script has the advantage that it can triangulate and area weight things.

What if I wanted all the faces of my mesh to have an equal area, or composed of near equilateral triangles? I don’t think there is a script that does this, however I think it could be useful especially in curved organic shapes. Something like a ‘subdivide into equal sized faces’ type plugin, granted it could be destructive.

Please tell me what you think about this idea, how might one go about writing this up? (I’ve never written a script for blender, but I’ve worked with python enough that I might give it a try)

P.S. Along the same lines, I had another thought. Is there some way to subdivide a mesh based on the detail therin? So suppose I have a heightmap that is totally flat, but has a canyon and a river meandering through it. Assuming all the faces of the mesh are generally equal in shape, I would want to subdivide the faces that have the biggest variation. The flat areas remain low detail and the rough areas get subdivided. I.e. if the the angle between two vertex normals was greater than some value, then subdivide. Or even subdive edges x number of times where x = the angle between vertex normals / some value.

This thread is turning into a blog. So I played around with this idea over the weekend. I modeled about 10 miles of Oregon coastline (lots of cliffs and rocky islands). I started with a grid of 200x200 and applied the displacement map. This produces a very rough approxamation. Then I ran the poly-reducer script with the area weight parameter at maximum (20) and a ratio of .125 reduction and triangulation set. So this went from 40000 quads to 10000 tirangles. This took a really long time to process on my less than ideal computer. The result was a mesh with all triangles relatively the sam size and edges roughly following the contour of the terrain. The ocean (completely flat) showed a regular pattern of triangles, and the hills and mountains generally had endges along ridge lines.

Then I flattened the whole model (scale z by 0), added a simple subdivide modifier and the same displacement modifier again. At 3 or 4 subdivisions the result looked really great and the endges seemed to follow the conour of the terrain much better.