# Procedural planet shader on a plane

**URL:** <https://blenderartists.org/t/procedural-planet-shader-on-a-plane/1563492>\
**Category:** Works in Progress\
**Tags:** space, science, procedural, shader-nodes\
**Created:** [December 18, 2024, 7:49pm UTC](https://blenderartists.org/t/procedural-planet-shader-on-a-plane/1563492 "2024-12-18T19:49:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sml](https://blenderartists.org/user_avatar/blenderartists.org/sml/32/1312139_2.png) [@sml](https://blenderartists.org/u/sml)\
**Post date:** [December 18, 2024, 7:49pm UTC](https://blenderartists.org/t/procedural-planet-shader-on-a-plane/1563492/1 "2024-12-18T19:49:47Z")

</div>

![HDRI_preview](https://blenderartists.org/uploads/default/original/4X/2/a/3/2a3ce8367d9b21adc68055028efe7d4f076a11a6.jpeg)

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](https://blenderartists.org/t/alien-worlds-jumpship-over-a-tidally-locked-planet/1556391), 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:

1. Converting the UV space into something resembling a projected normal map of a sphere:  
 ![normal_map](https://blenderartists.org/uploads/default/original/4X/8/3/b/83bd6b5883920b7f0f8c9e40255ea88e0adef23c.png)
2. Using a simple phong shader that takes this normal map, a 3D light direction vector and creates diffuse “shading”:  
 ![shader](https://blenderartists.org/uploads/default/original/4X/a/e/4/ae449e021f2fde42fdd0447ad99358910f6d030c.png)
3. 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)
4. 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).

---

<div class="post-metadata">

**Author:** ![sml](https://blenderartists.org/user_avatar/blenderartists.org/sml/32/1312139_2.png) [@sml](https://blenderartists.org/u/sml)\
**Post date:** [December 22, 2024, 10:54am UTC](https://blenderartists.org/t/procedural-planet-shader-on-a-plane/1563492/2 "2024-12-22T10:54:29Z")

</div>

I transfered the node graph to the world shader, added clouds with bump mapping and shadows, as well an approximation of what a close-up could look like (reducing the extend of the texture and the planet’s surface curvature).

---

<div class="post-metadata">

**Author:** ![Secrop](https://blenderartists.org/user_avatar/blenderartists.org/secrop/32/20093_2.png) [@Secrop](https://blenderartists.org/u/Secrop)\
**Post date:** [December 22, 2024, 11:15am UTC](https://blenderartists.org/t/procedural-planet-shader-on-a-plane/1563492/3 "2024-12-22T11:15:43Z")

</div>

That’s nice transform of the UV coordinates… 🙂  
Keep it going 😉
