Sunfall is a shadertoy that I developed to try a simple crepuscular ray effect using radial blur. This post briefly goes through some of the steps in my implementation.
Sky and Terrain
I started by coloring the sky with a mix of blue and orange according to approximate the look of a sunset. I raymarched the terrain using Ridged Perlin Noise and composited the result with the background by applying a simple fog model. The code below implements the terrain. Notice that I use a low-quality version in the raymarcher and a high-quality one for computing the normals, which speeds up the shader significantly.
I computed normal vectors using central differences over the terrain distance function. The offset at which the terrain is sampled increases quadratically with the distance to the camera, so that details are filtered out to avoid aliasing.
Terrain Shading
I implemented a diffuse (Lambertian) and specular (Sloan-Hoffman) BRDF models for shading the terrain. A fill light is also present at the camera position, but it only contributes diffuse lighting. A constant ambient illumination model is applied to wash out the whole scene.
Sun Rendering and Compositing
In a first pass, I created an occlusion mask that specifies which pixels receive light directly from the sun. A second pass applies a radial blur onto the mask so as to cheaply simulate crepuscular rays. The result is composited with the sky and terrain using a yellow color.
Volumetric Dust
Finally, I included a dust effect by raymarching a 3D Value Noise procedural function. After hitting the terrain, the raymarcher starts walking backwards at fixed steps to render the dust. For shading, instead of computing the normals and taking the dot product with the sun direction, I used directional derivatives to speed up this process, as explained in this link.