Terrain
Posted: Mon Dec 09, 2013 10:50 am
This might be a little rambling but it's been bugging me.
Our terrain is ... rubbish, by modern standards.
Now it's quite an achievement in many ways, and this isn't a dig at the technical our artistic competancies of anyone who has worked on it (especially since I've done a lot on it!) but it just doesn't measure up against what we all know is actually possible.
I've tried several times now to come up with better ways of generating, texturing, rendering our terrain but everytime it's simply been too much because when taken in total it is a Herculean task to do alone.
So lets brain-dump:
Height generation
Problems start with it outputting values in ridiculously small ranges, this why we need to use double precision for it not because float wouldn't be enough.
I think that this is done because we generate the spherical meshes patches in the range 0.0 to 1.0, then we add on the terrain heights. Those heights are typically very small compared to the radius of the planet itself, take the Earth with a radius of 6371 Km which has a highest point above sea level of 8.8km. All of the surface of the Earths geography therefore has to fit into the range 0.0 to 0.00138125. Which makes having smooth landscape tricky unless you use the extra precision of double data types. It's also a further problem when you consider that most of that range will not actually be used, in fact the lower half of that range will account for something like 90% of the landscape on an earth like planet due to weathering / erosion. only a few peaks and ranges reach into the upper half.
This leads to the problem with my first attempt to fix this - texturing the terrain based on altitude and slope.
If the height was in a normalised range between 0.0 and 1.0 then we could easily calculate the slope/gradient of the terrain from it's normal and use these two values as a lookup into a texture atlas to give us varied terrain textures by height and the steepness of the terrain at that height. This is basically how the terrain in Infinity & Outerra works with added noise to break up uniformity, and we can all agree that it produces good results.
One way to get the normalised range this would be to multiply the terrain heights by the radius of the planet, which brings us to the next problem: our terrain noise algorithms don't produce noise within a reliable range, so when the values are multiplied up they can often be in 0.0 to 3.0, or 0.05 to 2.5 or anything in between. These values are still small but they're not normalised or predictable, worse still, turning the existing "Planet Texturing" on/off or altering the current noise values changes the ranges you might get out of the height generation making it unreliable - this is why if you change the terrain setting whilst on a landing pad you sometimes end up with buildings floating in the air or completely buried underground.
In the long run this is going to need completely rewriting to produce normalised terrain heights. It is the only option as far as I can tell.
So what I'd like us to start discussing is how to rewrite it.
...what I've started to do will come in a second post.
Our terrain is ... rubbish, by modern standards.
Now it's quite an achievement in many ways, and this isn't a dig at the technical our artistic competancies of anyone who has worked on it (especially since I've done a lot on it!) but it just doesn't measure up against what we all know is actually possible.
I've tried several times now to come up with better ways of generating, texturing, rendering our terrain but everytime it's simply been too much because when taken in total it is a Herculean task to do alone.
So lets brain-dump:
Height generation
Problems start with it outputting values in ridiculously small ranges, this why we need to use double precision for it not because float wouldn't be enough.
I think that this is done because we generate the spherical meshes patches in the range 0.0 to 1.0, then we add on the terrain heights. Those heights are typically very small compared to the radius of the planet itself, take the Earth with a radius of 6371 Km which has a highest point above sea level of 8.8km. All of the surface of the Earths geography therefore has to fit into the range 0.0 to 0.00138125. Which makes having smooth landscape tricky unless you use the extra precision of double data types. It's also a further problem when you consider that most of that range will not actually be used, in fact the lower half of that range will account for something like 90% of the landscape on an earth like planet due to weathering / erosion. only a few peaks and ranges reach into the upper half.
This leads to the problem with my first attempt to fix this - texturing the terrain based on altitude and slope.
If the height was in a normalised range between 0.0 and 1.0 then we could easily calculate the slope/gradient of the terrain from it's normal and use these two values as a lookup into a texture atlas to give us varied terrain textures by height and the steepness of the terrain at that height. This is basically how the terrain in Infinity & Outerra works with added noise to break up uniformity, and we can all agree that it produces good results.
One way to get the normalised range this would be to multiply the terrain heights by the radius of the planet, which brings us to the next problem: our terrain noise algorithms don't produce noise within a reliable range, so when the values are multiplied up they can often be in 0.0 to 3.0, or 0.05 to 2.5 or anything in between. These values are still small but they're not normalised or predictable, worse still, turning the existing "Planet Texturing" on/off or altering the current noise values changes the ranges you might get out of the height generation making it unreliable - this is why if you change the terrain setting whilst on a landing pad you sometimes end up with buildings floating in the air or completely buried underground.
In the long run this is going to need completely rewriting to produce normalised terrain heights. It is the only option as far as I can tell.
So what I'd like us to start discussing is how to rewrite it.
...what I've started to do will come in a second post.