Magrathea - a full-scale planet rendering project

Hi all,

I created an experimental project recently which applies my quadtree terrain algorithm to full-scale planets. I’ve been wanting to do this for a while now, but haven’t been able to overcome the various issues with rendering planet-sized objects without getting frustrated and giving up. Now, I’ve got it working! It’s available here.


8 Likes

Magrathea

I see what you did there :face_with_monocle:

Do you know where your towel is?

That looks insanely epic! :clap:

2 Likes

Thanks for looking! Well my main concern is whether there’s any tea on this spaceship.

1 Like

Try that vending machine in the room in the back there.

I had the question of how you would detect collisions?

Ray Casting? or some AABB equation of sorts?

One way to do it is by sampling the height function. The terrain’s generated with a 3D noise function that creates a single number from any x, y, z position you give it.

You start out by mapping each vertex position onto a perfect sphere (i.e. Normalize(vertexWorldPosition)*planetRadius), and then you give this to the noise function to generate a height which is applied as a delta from the perfect sphere position.

If you did the same thing with your colliding object position, you could work out the ground height underneath it and just do a height comparison to see how far under/above the ground you are.

In different projects with planar terrains which aren’t adaptive, you know the entire world is a regularly spaced vertex grid so you can do triangle intersection tests (there’s an example of that in my chunked terrain project!)

2 Likes

Ooh I just made quite a big improvement to speed and visual quality by changing the normal calculation algorithm. Now, rather than sampling the heightfield in a cross filter, normals are calculated straight from the triangles. This seems to be a lot faster, and gives smoother graphics, especially at large heights:


3 Likes