The flat earthers were right all along, earth is a plane! Here’s my proof:
Okay so jokes aside, what’s going on here?
This is a WIP shader for projecting planets onto 2D surfaces and shade them (with some stylistic freedom). Why? Because this is quite useful when you transfer it to the world background shader; the plane is just for easier prototyping and jokes. I already created a hacky version of this shader a while ago which I used in this project, but I decided to rebuild it from scratch and actually figure out the math for projecting a sphere onto a plane.
This is how it works:
- Converting the UV space into something resembling a projected normal map of a sphere:
- Using a simple phong shader that takes this normal map, a 3D light direction vector and creates diffuse “shading”:
- The environment texture node allows equirectangular textures to be mapped by using the normal map as input (as opposed to UV coordinates that the image texture would require)
- A bit of math that uses the distance from the center as input to create the atmosphere (and by using the Phong shader’s falloff function to create a bit of Rayleigh scattering)
I’m going to transfer this shader to the world shader, add a bunch of bells and whistles, make it parametric, add a few modular procedural terrain and cloud textures from another project, and then I got myself a fully interactive planet HDRI with proper perspective (yay).