# What's a reasonable triangle size for terrain?

## Recommended Posts

As some of you know I'm doing procedural planet generation.  My algorithm needs a very rough size for the highest resolution terrain voxels.  It bases LOD calculations on that value.  For flat terrain the size of a mesh triangle (which will be roughly equilateral) will be equal to the voxel size. What I'm wondering is what's a good size for the edge of such a triangle. I was thinking maybe 25 cm.  To clarify this would be the size of a triangle under the feet of a standing character.

I guess what I'm asking is what is the range of values for triangles in terrain meshes used in games these days.  I know it will vary, but I'm trying to get a ball park figure for say a theoretical average 3D game.

Edited by Gnollrunner

##### Share on other sites

0.5m between heightmap vertices is common for recent large open-world games. iirc the most recent Far Cry, Ghost Recon: Wildlands, and Horizon: Zero Dawn all use somewhere around (or exactly?) that number. Generally you can then use various tricks to improve the perceived terrain detail (tessellation of nearby tris, parallax occlusion mapping, etc.).

Edited by Valakor
Clarification

##### Share on other sites

The questions I forget I should have asked.. awesome!

##### Share on other sites

As a rule, both in real life and in games, terrain itself is very smooth and has low details.

Objects on the terrain make it interesting.  Those are among the "tricks" used for detail, add a bunch of modeled objects in the world near where the player is interacting. Trees and shrubs, rocks, grass, structures or buildings, and other objects. Similarly for cliff faces, waterfalls, or vertical surfaces.  None of those are not the terrain, they are objects on the terrain.

##### Share on other sites
9 hours ago, frob said:

As a rule, both in real life and in games, terrain itself is very smooth and has low details.

Objects on the terrain make it interesting.  Those are among the "tricks" used for detail, add a bunch of modeled objects in the world near where the player is interacting. Trees and shrubs, rocks, grass, structures or buildings, and other objects. Similarly for cliff faces, waterfalls, or vertical surfaces.  None of those are not the terrain, they are objects on the terrain.

Yeah mostly, however I would say cliff faces are terrain and rocks.....well it kind of depends on what kind of rocks we are talking about. Like if they are pillars of rock cut out by rivers that might be considered terrain.  It's also a matter of the algorithm used. With voxel algorithms you can create overhangs, caves and so forth, so what is impossible to create with a height map can be done with voxels and so such things would fall under the category of terrain.

##### Share on other sites
12 hours ago, frob said:

Objects on the terrain make it interesting.  Those are among the "tricks" used for detail, add a bunch of modeled objects in the world near where the player is interacting. Trees and shrubs, rocks, grass, structures or buildings, and other objects. Similarly for cliff faces, waterfalls, or vertical surfaces.  None of those are not the terrain, they are objects on the terrain﻿.

For me, with this common approach of placing unique models on the terrain, the resulting discontinuities are one of the most illusion breaking issues of current state of the art. (I wonder if i am the exception or the majority here.)

I prefer any approach that avoids this, procedural geometry, megatextures, POM for little details, etc., even if the downside is lower texture resolution.

##### Share on other sites
54 minutes ago, JoeJ said:

For me, with this common approach of placing unique models on the terrain, the resulting discontinuities are one of the most illusion breaking issues of current state of the art. (I wonder if i am the exception or the majority here.) ﻿

But you can always place models such as rocks and trees on the terrain procedurally .... which brings me to the newest algorithm I came up with ( seems like I have one every week 😛).  It's basically noise with with discrete points.  Hopefully I can demo it in my next blog release or the one after.  I'll start out by doing craters for a moon like planet but eventually I'll get to trees and stuff when I get that far.

##### Share on other sites
13 hours ago, JoeJ said:

For me, with this common approach of placing unique models on the terrain, the resulting discontinuities are one of the most illusion breaking issues of current state of the art. (I wonder if i am the exception or the majority here.)

I prefer any approach that avoids this, procedural geometry, megatextures, POM for little details, etc., even if the downside is lower texture resolution.

Most AAA games these days dealing with large terrains utilize some form of virtual texturing / clipmaps / etc. for enhanced texture detail near the viewer. A benefit of having all that information laying around is that you can sample from it to blend your objects with the ground. If done right you can 'automatically' create pretty convincing details at the seams between, say, a rock and the sand beneath it (where the sand blends up a little onto the rock). A general improvement to this technique is to blend the normals between the terrain and the object in this small transition area to remove some of the edge discontinuity.

If taken to the extreme, this approach can add a lot of detail. By combining geometry + terrain decals + terrain clipmaps, you can create a sort of 'geometric terrain decal'. Imagine that you have a decal of a couple rocks that you render into your terrain clipmap; this creates interesting texture detail, but no geometric detail. You could instead render a model of those (textured) rocks instead, but when those rocks LOD out at some distance you lose your texture detail as well. If you separate your geometry + decal you can get good-looking results at a greater variety of distances.

1. Render the rocks decal into your terrain clipmaps. You'll see this decal in the terrain for as far away as your clipmaps support, but obviously with no geometric detail added.
2. At close-ish distances, render the geometry of the rocks that matches the decal using a technique that purely derives its material properties from the clipmaps underneath it.
3. Profit! Your nearby terrain gains both geometry + texture detail, and further-away terrain gains texture detail, all without having to increase the resolution of your heightmap.

I'm not sure if this technique is super widespread (I imagine many studios have some equivalent), but I first saw it last year at GDC (GDC 2018 - "Terrain Rendering in 'Far Cry 5'"). I highly recommend that talk and the related "Procedural World Generation of 'Far Cry 5'" if you have access.

Edited by Valakor

##### Share on other sites
46 minutes ago, Valakor said:
• Render the rocks decal into your terrain clipmaps. You'll see this decal in the terrain for as far away as your clipmaps support, but obviously with no geometric detail added.
• At close-ish distances, re﻿nder the geometry of the rocks that matches the decal using a technique that purely derives its material properties from the clipmaps underneath it.
• Profit! Your nearby terrain gains both geometry + texture detail, and further-away terrain gains texture detail, all without having to increase the resolution of your heightmap.﻿

Yeah, but i'm still not happy with that. In fact the problem comes up more with recent highly detailed games than with older ones. The more details we add, the more likely remaining issues become illusion breakers.

The problem is, if you add decals, maybe even with POM so they peak correctly through the height map, the intersections with the terrain pop out. Different texture or geometry resolution, just one of them and it breaks. Also, detailed rocks or houses changing their LODs at other distances than the terrain is not really an advantage i think. Although overall the added details are great, those techniques reveal kind of dirty tricks.

So what i would suggest is to abandon height maps in general. I see no more need for them. Instead of messing with hackery to allow things like caves or overhangs, why not just a general solution to handle LOD with all static world geometry? I see that's not easy, and we loose things like instancing rocks, easily sharing their textures, etc., but streaming is necessary anyways with open world.

However, i see i'm daydreaming - pretty much a long time goal with many problems to solve. E.g. likely foliage can never be handled with a uniform world geometry approach, but rocks and most architecture should be possible.

Another option would be to blur the final image to hide decal discontinuities. I would be happy with that. CG is much too sharp for me, but many or even most people desire crisp images. (It's interesting how movies get this right when they mix CG and real footage and everybody agrees with that, but if we release a game that's a bit blurry, people are angry about that.)

I also wonder if anybody ever tried to smooth dithered transparency with temporal AA? This would be a real fix for such issues if it works.

##### Share on other sites

Yeah the first game that I saw the "blend meshes with the terrain's shading" trick was Star Wars battlefront (the recent frostbite one, not the original). They use a lot of photogrammetry-sourced rocks and cliff-faces, and this trick completely hides the seams with the heightmap terrain. The result is that it really does look like the entire terrain is one big unique mesh, instead of a heightmap plus instanced rocks... I was very impressed and want to do more texture space shading stuff now

Off topic but they also used incredibly low resolution textures on most objects, which should look absolutely awful, but then layered a palette of per-vertex-selected detail textures over the top of everything that again made things look like they were full of unique detail instead of repeated assets.

As for the original question, triangles should be larger than 2x2 pixels in screen space. Given a certain resolution and FOV, you can use some simple trigonometry to come up with a guess of an appropriate triangle size to use at different distances so that this rule of thumb isn't violated.

## Create an account

Register a new account

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 28
• 16
• 10
• 10
• 11
• ### Forum Statistics

• Total Topics
634107
• Total Posts
3015549
×