I just spent 20 minutes pulling my hair out because of one little checkbox called Flatten surface first. I guess what confused me is that it feels like a double negative the way I think about things.
Flatten surface first applies to Heightfield Shaders and indicates whether the referenced heightfield should be flattened before being rendered. The way my brain works, “flattening” should mean that the heightfield is wrapped onto the planet sphere so that it’s “flat” in the sense of elliptic geometry. The way TG2 actually works, “flattening” means to leave the heightfield flat in the sense of planar geometry.
What does this all really mean?
Let’s take a heightfield that represents a constant altitude (i.e. it’s all one color when viewed as an image file) and place it onto the surface of a planet. Let’s give the planet an ocean to make more obvious what’s happening. The Flatten surface first checkbox of the Heightfield Shaders are checked.
The result: The constant altitude heightfield is flat in XYZ space rather than flat on the surface of the planet. The lower left corner is close to the planet, but the world’s curvature causes the ocean to fall further below the surface of the heightfield the further it moves away from the origin:
Now let’s uncheck Flatten surface first. TG2 now wraps the heightfield around the surface of the planet the way one would expect terrain to follow the planet’s curvature.
So what happened to the land? It’s below the water’s surface now… in fact, it’s all at the same altitude as the lower-left corner of the original image, which was also below the water’s surface. Let’s lower the oceans a bit and we’ll see that the land is now at a uniform altitude from the point of view of the planet.
Voila! Flat land.