ajmas / StuffInSpace

A real-time interactive WebGL visualisation of objects in Earth orbit
https://ajmas.github.io/StuffInSpace/
24 stars 9 forks source link

Earth: Add atmosphere #19

Open ajmas opened 9 months ago

ajmas commented 9 months ago

Explore adding an atmosphere effect, such that when you see the edge of the horizon you see an atmosphere layer. This will likely need some shader work.

thkruz commented 8 months ago

Here are three approaches:

1) We can reuse some of my shader work from http://keeptrack.space 2) We can build a secondary mesh that glows behind the earth mesh. I had done that in the past on KeepTrack but migrated to the current solution because I am still learning how to draw geometries with raw WebGL - we shouldn't have that issue with three. 3) A mix of the two.

If you want to color the atmosphere then we use the dot product of the vector from the sun's position to the earth to determine if a vertex is on the edge and then pass that to the fragment shader to determine what color to make it. This looks more like Kerbal to me vs an engineering tool (which is always ideal to me).

The more common approach I have seen on the internet is to use a white/blue color regardless of sun angle and just blur it.