God Rays & Volumetric Beams
Beams of sunlight fanning from a corner through haze, with intensity, beam width and direction controls.
AI prompt
Atmospheric forest photograph at early morning with strong god rays, shafts of warm golden sunlight streaming diagonally through the trees from the upper left and fading with distance, misty haze making the beams visible, dark silhouetted tree trunks in the foreground cutting the light into separate columns, cool green shadows, 35mm lens, shallow depth of field, serene and cinematic. Variants: thin sparse beams in clear air, and wide soft beams in heavy fog. Negative: artificial lens flares, oversaturation, hard edged stripes, people, text. Reduced motion: static image.About this pattern
Definition
God rays, or crepuscular rays, are visible shafts of light that appear when sunlight passes through gaps in clouds or trees and scatters off haze, dust or mist. Without particles in the air the light beams are invisible, so haze is the key ingredient.
When to use it
- Place the light source at or just beyond the edge of the frame, behind the subject.
- Rays fan outward from the source and get fainter with distance.
- More haze gives brighter, wider beams; clear air gives almost none.
- Dark shapes in front, such as trunks, cut the light into separate beams.
What the controls do
- Intensity, Beam width and Direction sliders.
Motion & timing
- Updates follow the sliders.
- Reduced motion: nothing animates.
Tips & variations
- Use screen blending so the beams add light instead of covering the scene.
- Keep beams subtle; heavy rays look artificial.
Code of this live preview
<div class="bx"><div class="sc" id="sc"><div class="bg"></div><div class="rays" id="rays"></div><div class="tr"><i style="left:14%"></i><i style="left:34%;width:12px"></i><i style="left:58%"></i><i style="left:80%;width:14px"></i></div></div><div class="three"><label class="rw">Intensity <b id="iv">60%</b><input id="it" type="range" min="0" max="100" value="60"></label><label class="rw">Beam width <b id="wv">3°</b><input id="wd" type="range" min="1" max="6" value="3"></label><label class="rw">Direction <b id="dv">180°</b><input id="dr" type="range" min="130" max="230" value="180"></label></div></div>:root{--bg:#F1F1EF;--surface:#fff;--surface-2:#F7F7F5;--line:#E0E0DC;--text:#171717;--muted:#6f6f6f;--accent:#171717;--accent-ink:#fff;--danger:#d92d20}
*{box-sizing:border-box;margin:0}
button{font:inherit;color:inherit;background:none;border:0;padding:0;cursor:pointer}a{color:inherit;text-decoration:none}ul,ol,p,h4{margin:0;padding:0}.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.pre{display:flex;gap:5px;flex-wrap:wrap}.pre button{height:28px;padding:0 11px;border-radius:99px;border:1px solid var(--line);background:var(--surface);font-size:11px;cursor:pointer}
.pre button[aria-pressed=true]{background:var(--accent);color:var(--accent-ink);border-color:var(--accent)}
.bx{width:min(330px,100%);display:grid;gap:9px}.rw{display:grid;gap:3px;font-size:11.5px;color:var(--muted)}.rw b{color:var(--text);font-weight:600}input[type=range]{width:100%;accent-color:#171717}
.out{font-size:12px;color:var(--muted);line-height:1.4}.out b{color:var(--text)}
button:focus-visible,input:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.sc{height:130px;border-radius:12px;position:relative;overflow:hidden;background:#1b2a24;isolation:isolate}.bg{position:absolute;inset:0;background:radial-gradient(circle at 18% -10%,rgba(255,226,150,.5),transparent 55%),linear-gradient(#24372f,#142019)}.rays{position:absolute;inset:-20%;background:repeating-conic-gradient(from var(--a) at 18% 10%,rgba(255,236,180,var(--i)) 0 var(--w),transparent var(--w) calc(var(--w)*3));mix-blend-mode:screen;filter:blur(3px);-webkit-mask-image:linear-gradient(115deg,#000,transparent 80%);mask-image:linear-gradient(115deg,#000,transparent 80%)}.tr i{position:absolute;bottom:0;width:9px;height:100%;background:#0a0f0c}.three{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}
@media (prefers-reduced-motion:reduce){*{transition:none!important;animation:none!important}}const sc=document.getElementById('sc'),r=document.getElementById('rays'),it=document.getElementById('it'),wd=document.getElementById('wd'),dr=document.getElementById('dr');
function up(){r.style.setProperty('--i',(it.value/100*.7).toFixed(2));r.style.setProperty('--w',wd.value+'deg');r.style.setProperty('--a',(dr.value-180-wd.value*1.5)+'deg');document.getElementById('iv').textContent=it.value+'%';document.getElementById('wv').textContent=wd.value+'\u00b0';document.getElementById('dv').textContent=dr.value+'\u00b0';}
[it,wd,dr].forEach(i=>i.addEventListener('input',up));up();One complete HTML file. Save it and open it in a browser.
<!doctype html>
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>God Rays & Volumetric Beams — demo</title>
<style>
:root{--bg:#F1F1EF;--surface:#fff;--surface-2:#F7F7F5;--line:#E0E0DC;--text:#171717;--muted:#6f6f6f;--accent:#171717;--accent-ink:#fff;--danger:#d92d20}
*{box-sizing:border-box;margin:0}
html,body{height:100%}body{background:var(--bg);color:var(--text);font:15px/1.5 -apple-system,BlinkMacSystemFont,'Segoe UI',Inter,Roboto,sans-serif;-webkit-font-smoothing:antialiased}.stage{min-height:100%;display:grid;place-items:center;padding:24px}button,input,select,textarea{font-family:inherit}@media (prefers-reduced-motion:reduce){html{scroll-behavior:auto}}
button{font:inherit;color:inherit;background:none;border:0;padding:0;cursor:pointer}a{color:inherit;text-decoration:none}ul,ol,p,h4{margin:0;padding:0}.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.pre{display:flex;gap:5px;flex-wrap:wrap}.pre button{height:28px;padding:0 11px;border-radius:99px;border:1px solid var(--line);background:var(--surface);font-size:11px;cursor:pointer}
.pre button[aria-pressed=true]{background:var(--accent);color:var(--accent-ink);border-color:var(--accent)}
.bx{width:min(330px,100%);display:grid;gap:9px}.rw{display:grid;gap:3px;font-size:11.5px;color:var(--muted)}.rw b{color:var(--text);font-weight:600}input[type=range]{width:100%;accent-color:#171717}
.out{font-size:12px;color:var(--muted);line-height:1.4}.out b{color:var(--text)}
button:focus-visible,input:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.sc{height:130px;border-radius:12px;position:relative;overflow:hidden;background:#1b2a24;isolation:isolate}.bg{position:absolute;inset:0;background:radial-gradient(circle at 18% -10%,rgba(255,226,150,.5),transparent 55%),linear-gradient(#24372f,#142019)}.rays{position:absolute;inset:-20%;background:repeating-conic-gradient(from var(--a) at 18% 10%,rgba(255,236,180,var(--i)) 0 var(--w),transparent var(--w) calc(var(--w)*3));mix-blend-mode:screen;filter:blur(3px);-webkit-mask-image:linear-gradient(115deg,#000,transparent 80%);mask-image:linear-gradient(115deg,#000,transparent 80%)}.tr i{position:absolute;bottom:0;width:9px;height:100%;background:#0a0f0c}.three{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}
@media (prefers-reduced-motion:reduce){*{transition:none!important;animation:none!important}}
</style></head>
<body><div class="stage">
<div class="bx"><div class="sc" id="sc"><div class="bg"></div><div class="rays" id="rays"></div><div class="tr"><i style="left:14%"></i><i style="left:34%;width:12px"></i><i style="left:58%"></i><i style="left:80%;width:14px"></i></div></div><div class="three"><label class="rw">Intensity <b id="iv">60%</b><input id="it" type="range" min="0" max="100" value="60"></label><label class="rw">Beam width <b id="wv">3°</b><input id="wd" type="range" min="1" max="6" value="3"></label><label class="rw">Direction <b id="dv">180°</b><input id="dr" type="range" min="130" max="230" value="180"></label></div></div>
</div>
<script>
const sc=document.getElementById('sc'),r=document.getElementById('rays'),it=document.getElementById('it'),wd=document.getElementById('wd'),dr=document.getElementById('dr');
function up(){r.style.setProperty('--i',(it.value/100*.7).toFixed(2));r.style.setProperty('--w',wd.value+'deg');r.style.setProperty('--a',(dr.value-180-wd.value*1.5)+'deg');document.getElementById('iv').textContent=it.value+'%';document.getElementById('wv').textContent=wd.value+'\u00b0';document.getElementById('dv').textContent=dr.value+'\u00b0';}
[it,wd,dr].forEach(i=>i.addEventListener('input',up));up();
</script>
</body></html>