P-152: Virtual World Concept Update 127: Planet-sized Terrain: Part 6
I have discovered, and fixed, a bug in the procedural texturing code for the spherical terrain.
Initially, I had set the terrain’s position to the origin. However, to render the planet at a realistic scale, I need to implement the floating origin system, which requires being able to specify an arbitrary position for the planet. I had implemented this, but I hadn’t realised that there was a bug in the code which meant that the distance calculations for the minimum and maximum terrain heights weren’t properly taking into account the changes in the planets position.
This meant that the planet was not being textured properly.
This turned out to be more complex to fix than I thought, I first ended up with this effect:

And I then finally managed to get a working solution:



But that was still not correct, the min and max height values were strongly biased in favour or water and rock types. Eventually I solved the issues, and the terrain renders correctly. As it turned out, it was easier than I thought to solve this, I didn’t actually need to take into account the world position at all, since the terrain coordinates were in local space.

This solution has also solved a lot of the texturing issues that I was having with the terrain scaling, in fact, the texture looks more or less correct now. This has inspired me to continue trying to solve the realistic terrain problem.


