Been working hard on this planet rendering. Managed to get to terrain data correctly mapping to the surfaces and moved onto managing level of detail on the surface. I noticed certain parts of my planets were very flat and were not making much use of my tessellation shader. So I capped to amount of tessellation that can be applied to certain triangles based on the different in height of each one of its vertices. Below is an image of the effect of this level of detail capping, with the mountains getting a lot of tessellation and flat lands getting very little.
Interestingly I was having slight issues getting the tessellation for the centre of the triangles to a correct value as to reflect the edges. So I decided to factor in the golden ratio which seemed to work really well, which is really cool as the whole point of the golden ratio is perfection. Oddly enough I also use the golden ratio to procedurally generate my icosahedron shapes as well. I definitely want to look more into this number, it seems to have a really interesting history and application.
I had to sort out the lighting, so initially I created a geometry shader and recalculated the normals based on the cross section of each triangle. Though this got me really edgy lighting. So I decided to interpolate it with its original sphere normals to calculate the final normal. It looks really nice from a distance, though gets a few artefacts up close. Ideally I want to create a normal map along with the procedural terrain data, but this is a nice fast solution for the time being.
So I’ve got it all working, and been testing around with multiple planets in a single space. I’ve gone up to 100 (took a long time to generate all the terrain data though, need compute shaders) with no issues. Got a small video below with 4 planets of different sizes in a single space, i fly from planet to planet showing there geometry tessellate and the what it all looks like. I am quite happy with it all.