Heightmap Interpolation

Does anyone here, preferably someone with a source code license, happen to know what type of interpolation Unity uses for heighmaps? Bilinear, I’m assuming.

Well, given that heightmaps are essentially a 2D data structure, bilinear interpolation does make sense.

However, that doesn’t cover much of how unity terrains work. You interpolate between pixels once you get to a pixel (actually, texels) density where you have more vertices than texels (and if you used point filtering, you’d get square terraces). But before that happens, the terrain is progressively subdivided so you get more detail closer to the camera and where terrain features are more prominent.

The way these subdivisions happen look like they are the product of a ROAM algorithm (or ROAM-like). Terrain is a quad-tree structure, where each quad subdivides into four child quads, and so on recursively, adding more detail where it’s needed.

Cheers