Procedural Real-Time Planet Shader
Basic setup
Place the blend file inside your asset library and drag and drop the "Procedural Planet" asset into your scene to get started. This will automatically import a sun lamp that always points towards the planet. This is needed to capture the sun direction, which is required for the shader to work properly.
In the World settings, turn down the strength of the background shader to zero, or replace it with a star field texture. Diffuse illumination of the dark side of the planet can be achieved with the Shadow Lift
parameter of the planet shader.
In the Render settings, decrease your sample count to 8-16, which is enough for both Eevee and Cycles. Higher sample counts only have a very minor effect on image quality, but will greatly increase your render times. Also enable render denoising.
You can change the sun lamp used for the directional vector in the Modifiers tab. There you will find a Geometry Nodes modifier called get_sun_rotation
, in which you can select a different object that should be used for the vector calculation (e. g. an Empty).
To add atmospheric haze in Eevee, enable Bloom in the Render tab. Values that work well are: Threshold 0.1, Knee 0, Radius 1.5, Intensity 0.2, Clamp 0.
To add atmospheric haze in Cycles, enable the optional glare
node in the Compositor (or combine it with the other preset effects like anisotropic flare
). In Blender 3.6 and above, you can also enable these effects in real-time in the Viewport by setting the Compositor setting to "Always" in the dropdown menu next to to the viewport shading icons.
Note: First-time initialization of the materials might take a few minutes because Blender needs to compile the huge shader graph.
Parameters explained
Main Shader
The main planet settings can be accessed right in the Materials tab. To access the terrain and cloud textures, open the material in a shader editor.
The main parameters are:
- Terminator Shift: move the shadow terminator forwards or backwards. See the Eevee vs Cycles section for more details. Range: -0.5-0.5
- Rayleigh Contrast: The width of the orange-colored band around the shadow terminator. Range: 0.2-20
- Rayleigh Strength: How much atmosphere and clouds should be influenced by the Rayleigh colors. Range: 0-2
- Rayleigh Hue: Albeit physically implausible, you can change the color of the Rayleigh effect here. Range: -1-1. Default is 0.
- Light Bend: Bend the edges of the illumination slightly backwards into the shadow to create the illusion of atmospheric scattering. Range: -1-1. Default is 0.2.
- Subsurf Scatter: Smoothen the transition between light and shadow. Higher values work better in Eevee, values up to 0.6 work in Cycles. Range: 0-1.
- Cloud Height: Defines the distance between clouds and cloud shadows and how far the clouds reach into the terminator. Range: 0-10.
- Cloud Shadow: Strength of the cloud shadows. Range: 0-5. Default is 1.
- Shadow Lift: Add a subtle diffuse light to the shadow side of the planet. Range: 0-10. Default is 1.
- Brilliance: Creates a brighter day side of the planet and brighter clouds. Can be used instead of a real sun lamp. Range: 0-1. Can be increased by entering values manually, if needed.
- Atmosphere Density: How thick the atmosphere appears. This value is exposed inside the terrain container to make textures adapt to the atmosphere. Range 0-4. Default is 1.
- Atmosphere Distribution: Determines the falloff of the atmosphere. Smaller values spread the atmosphere more evenly over the surface, higher values move the atmosphere towards the edges. Range: 0.5-2. Default is 1.
- Atmosphere Color: The color of the atmosphere. Luminosity values don't have any influence.
Texture Containers
Access to the texture settings is conveniently possible with the exposed Container groups. These can be left unplugged, as they are only duplicates of the same group that is used inside the main shader. By changing the texture settings inside a Container, this will automatically change all occurrences of the Container in the main shader as well.
There is one container that houses all cloud texture groups, which can be mixed and matched to layer different cloud types together.
The second container takes care of the terrain and emission texture groups. Emission textures can take a mask as input. This can be set to be either the Shadow Mask, or it can be combined with the Continent mask provided by some terrain groups. The terrain container also exposes an Atmosphere Density input. For more information, see the Creating your own materials section.
Eevee vs Cycles
Because the shader mostly consists of diffuse and emission data, its possible to use it both with Eevee and with Cycles at low sample counts (16 for both are usually fine). However, each engine has their Pros and Cons:
Eevee Pros:
- Fast viewport panning
- Easy atmospheric haze with Bloom
- Works well with Subsurface Scatter, Light Bend and Terminator Shift
- Very fast render times
Eevee Cons:
- Slow interaction with the shader settings (due to shader graph recalculation; this might change with Eevee Next in Blender 4.0). Its best to enter values directly instead of dragging the input fields.
- High dependency on shader complexity. Noise textures have a higher impact than Musgrave textures.
- High dependency on the distance to the camera. Close-ups will take longer to render.
- Using height data can slow down rendering.
- Does not work well with large image files.
Cycles Pros:
- Fast render times when keeping the sample count low
- Low dependency on camera distance
- Low dependency on shader complexity
- Very fast interaction with shader settings
- Fast rendering of height data
- Works well with large image files
Cycles Cons:
- Slower viewport panning
- Requires
Brilliance
to be set to 1 to get accurate effects beyond the shadow terminator, e. g. forTerminator Shift
,Light Bend
or clouds - Harsh shadow terminator line when using only a sun lamp without
Brilliance
enabled. - No easy bloom effect like in Eevee. Requires compositor effects to achieve a similar effect.
Recommended workflow
- For overall faster render results and a more accurate Bloom effect, Eevee is the better choice.
- For rapid interaction with the shader settings, temporarily switching to Cycles is a good idea.
- The Cycles sample count can be set really low (8-16 samples) and denoising should be turned on.
- For close-up renders or setups with large image textures, Cycles is a better choice than Eevee.
- When using Cycles,
Brilliance
should always be set to 1 to get proper light effects.
Creating your own materials
Its easy to add your own texture groups inside the Cloud and Terrain Containers to expand the capabilities of the shader. You can also add image-based textures instead of procedural textures.
When rendering with Eevee, its a good idea to keep an eye on shader complexity. Noise textures take a greater hit on performance than Musgrave textures, and higher dimensionality also impacts performance (its better to use 2D or 3D instead of 4D). High-resolution image textures don't play too well with Eevee (unless you have plenty of RAM).
The Terrain container exposes two inputs. One is a Shadow Mask that allows you to apply textures only to the shadow side of the planet. The other is the Atmosphere Density input, which can be used by texture groups to dynamically adapt to the current atmospheric density (see the Emission Cracks
texture as example).
Discover more products like this
real-time 3d planet planet atmosphere gas planet spring24 winter24 procedural space