{
  "schemaVersion": 1,
  "id": "god-rays",
  "version": "1.0.0",
  "status": "published",
  "kind": "background",
  "title": "God Rays Through a Door",
  "summary": "Shafts of golden light pouring through a doorway into a dark, dusty hall, motes floating in the beam. Loops perfectly.",
  "description": "A dark stone hall with light pouring in through an opening at the far end into dust-filled air. The shafts are real volumetric light: the doorway's shape, the pillars' shadows and the door leaf standing in the hall all cut the beam exactly, the foliage outside dapples it and drifts, and the air glows brightest when you look straight into the light. Dust motes float in the beam and flash as they turn, the bright opening blooms, and the camera creeps slowly forward. Choose the opening (a door ajar, a four-pane window or three pointed cathedral arches), the colour of the light (golden hour, dawn rose, moonlight or white), how dusty the air is, and whether there are pillars and motes.",
  "role": "Background (WebGL shader, full frame): cinematic volumetric light for dramatic, spiritual and moody scenes.",
  "collections": [
    "backgrounds",
    "hypnotic-loops"
  ],
  "tags": [
    "god rays",
    "light shafts",
    "volumetric light",
    "sunbeams",
    "dust",
    "doorway",
    "cathedral",
    "cinematic",
    "atmosphere",
    "haze",
    "loop",
    "background"
  ],
  "synonyms": [
    "crepuscular rays",
    "light beams",
    "sun rays through window",
    "volumetric lighting",
    "light through a door",
    "dusty light",
    "church light",
    "divine light"
  ],
  "useCases": [
    "A dramatic, reverent or spiritual backdrop for narration and titles",
    "Fantasy, history and horror scenes needing atmosphere",
    "A cinematic establishing shot for a story, a game or a podcast"
  ],
  "featured": null,
  "publishedAt": "2026-10-06",
  "implementation": {
    "target": "three",
    "runtime": "browser",
    "language": "javascript",
    "module": "esm",
    "entry": "src/god-rays.js",
    "exports": [
      {
        "name": "createGodRays",
        "signature": "createGodRays(renderer, { width, height, scene?, color?, haze?, columns?, motes?, intensity?, exposure?, glow?, seed? }) => { render(time, loopSeconds, output?), dispose() }",
        "description": "The whole scene (hall, light, haze, motes and bloom) drawn to the canvas or a render target."
      },
      {
        "name": "SCENES",
        "signature": "SCENES: { door, window, cathedral }",
        "description": "The three openings, with their stone colour."
      },
      {
        "name": "LIGHTS",
        "signature": "LIGHTS: { gold, dawn, moon, white }",
        "description": "Suggested light colours."
      }
    ],
    "reusable": [
      "src/god-rays.js"
    ],
    "demo": "demo.js",
    "harness": "index.html"
  },
  "dependencies": [
    {
      "id": "three",
      "version": "0.185.1",
      "reason": "Renderer, the full-screen volume shader and the mote points."
    },
    {
      "id": "apw-runtime",
      "version": "1.0.0",
      "scope": "demo",
      "reason": "Demo harness."
    }
  ],
  "params": [
    {
      "key": "scene",
      "label": "Opening",
      "type": "select",
      "default": "door",
      "options": [
        {
          "value": "door",
          "label": "Door ajar"
        },
        {
          "value": "window",
          "label": "Four-pane window"
        },
        {
          "value": "cathedral",
          "label": "Three cathedral arches"
        }
      ]
    },
    {
      "key": "light",
      "label": "Light",
      "type": "select",
      "default": "gold",
      "options": [
        {
          "value": "gold",
          "label": "Golden hour"
        },
        {
          "value": "dawn",
          "label": "Dawn rose"
        },
        {
          "value": "moon",
          "label": "Moonlight"
        },
        {
          "value": "white",
          "label": "White daylight"
        }
      ]
    },
    {
      "key": "haze",
      "label": "Dust in the air",
      "type": "number",
      "min": 0.3,
      "max": 2,
      "step": 0.05,
      "default": 1
    },
    {
      "key": "columns",
      "label": "Pillars",
      "type": "boolean",
      "default": true
    },
    {
      "key": "motes",
      "label": "Dust motes",
      "type": "boolean",
      "default": true
    },
    {
      "key": "exposure",
      "label": "Exposure",
      "type": "number",
      "min": 0.5,
      "max": 1.8,
      "step": 0.05,
      "default": 1
    },
    {
      "key": "seed",
      "label": "Seed",
      "help": "Changes the foliage's shadows and where the dust floats.",
      "type": "integer",
      "min": 1,
      "max": 999,
      "step": 1,
      "default": 3
    }
  ],
  "presets": [
    {
      "id": "default",
      "label": "Door ajar, golden hour",
      "params": {}
    },
    {
      "id": "cathedral",
      "label": "Cathedral arches",
      "params": {
        "scene": "cathedral",
        "light": "white",
        "haze": 0.7,
        "exposure": 0.95,
        "seed": 8
      }
    },
    {
      "id": "dawn",
      "label": "Window at dawn",
      "params": {
        "scene": "window",
        "light": "dawn",
        "haze": 1.2,
        "columns": false,
        "seed": 14
      }
    },
    {
      "id": "moon",
      "label": "Moonlit hall",
      "params": {
        "scene": "window",
        "light": "moon",
        "haze": 1.1,
        "exposure": 1.1,
        "seed": 5
      }
    }
  ],
  "output": {
    "width": 1080,
    "height": 1080,
    "fps": 30,
    "durationSeconds": 12,
    "posterSeconds": 4,
    "alpha": false,
    "motion": "procedural",
    "loop": {
      "seamless": true,
      "cycleSeconds": 12,
      "method": "The foliage's shadows drift round a circle, the motes orbit small loops a whole number of times, the camera, the door leaf and the cloud over the sun move as sines of the loop, so the last frame meets the first."
    },
    "seed": {
      "param": "seed",
      "behavior": "Seed shapes the foliage's shadows and places the dust."
    }
  },
  "composition": {
    "inputs": "Time within the loop; the opening, light colour, haze, pillars and motes.",
    "outputs": "A full frame, drawn by a volume shader, a layer of motes and a bloom.",
    "coordinates": "Metres: the hall is 8 wide, 7 high and 21 long; the opening is in the far wall, 12 m from the middle of the hall.",
    "lighting": "Self-contained: exact visibility of the sun through the opening, pillars and door leaf; forward-scattering haze; a little room fill.",
    "timing": "render(time, loopSeconds) is a pure function of time; frames render in any order.",
    "compatibleWith": [
      "kinetic-title",
      "stop-motion-feel",
      "dither-animation"
    ],
    "notes": [
      "Looking straight into the light the haze glows most: that is the forward scattering of real dust.",
      "The door leaf appears in the Door ajar opening only."
    ]
  },
  "reuse": [
    "Epic title: Cathedral arches with a serif title in the dark foreground.",
    "Spiritual narration: Door ajar at golden hour, motes on, behind a slow voice-over.",
    "Mystery: Moonlit hall under Dither Animation for a grainy, haunted feel."
  ],
  "integration": {
    "newProject": "Create a WebGLRenderer, createGodRays(renderer, { width, height }) and call render(time, loopSeconds) each frame.",
    "existingProject": "Copy src/god-rays.js and call render(time, loop, renderTarget) to use it as a backdrop texture."
  },
  "performance": {
    "notes": "One full-screen volume pass of 52 steps (the beam's density is only evaluated where it is lit), 700 motes and a small bloom. Smooth at 1080p on laptop GPUs.",
    "limits": "Software WebGL (no GPU) renders slowly. On phones, render at 720 and scale up."
  },
  "limitations": [
    "The hall is fixed: the opening, pillars and camera path are not parameters beyond those listed.",
    "The sun's direction drifts only a little; it does not move across the sky."
  ],
  "license": {
    "spdx": "MIT",
    "notice": "Copyright (c) 2026 AI Pixel Wizard. Released under the MIT License. See LICENSE in this folder.",
    "thirdParty": [
      {
        "name": "three.js",
        "version": "0.185.1",
        "license": "MIT",
        "url": "https://github.com/mrdoob/three.js"
      }
    ]
  },
  "provenance": "Adapted from the owner's threejs-sketches/light-atmosphere/god-rays (MIT), rebuilt for AI Pixel Wizard in October 2026 as true volumetric light: analytic visibility through three openings, pillar and door shadows with growing penumbra, forward-scattering haze, dappled foliage, dust motes, bloom, and the frame/time contract.",
  "changelog": [
    {
      "version": "1.0.0",
      "date": "2026-10-05",
      "notes": "Initial release."
    }
  ]
}
