Godrays

갓 레이

Volumetric light rays emanating from a point.

Also known as: GodraysGod raysVolumetric light rays

Moves in browsers that support WebGPU

This device could not render the demo — showing a still

React
// Renders only in browsers with WebGPU.
import { Shader, Godrays } from 'shaders/react'

export default function ShaderEffect() {
  return (
    <Shader style={{ width: '100%', height: 320 }} disableTelemetry>
      <Godrays />
    </Shader>
  )
}
Vue
<!-- Renders only in browsers with WebGPU. -->
<script setup lang="ts">
import { Shader, Godrays } from 'shaders/vue'
</script>

<template>
  <Shader style="width: 100%; height: 320px" :disable-telemetry="true">
    <Godrays/>
  </Shader>
</template>
Svelte
<!-- Renders only in browsers with WebGPU. -->
<script>
  import { Shader, Godrays } from 'shaders/svelte'
</script>

<Shader style="width: 100%; height: 320px" disableTelemetry>
  <Godrays />
</Shader>
Solid
// Renders only in browsers with WebGPU.
import { Shader, Godrays } from 'shaders/solid'

export default function ShaderEffect() {
  return (
    <Shader style={{ width: '100%', height: '320px' }} disableTelemetry>
      <Godrays />
    </Shader>
  )
}
JavaScript
// Renders only in browsers with WebGPU.
// expects <canvas id="canvas" style="width:100%;height:320px"></canvas> on the page
import { createShader } from 'shaders/js'

const shader = await createShader(document.getElementById("canvas"), {
  components: [
    {
      type: 'Godrays',
    }
  ]
}, { disableTelemetry: true })

Props · Godrays

Changes apply to the demo above and to the code tabs. Descriptions come from the library registry (MIT).

NameValueDefaultRange / optionsDescription
centerCenter
x0y0
{"x":0,"y":0}x, y: 0 – 1The center point of the god rays
densityDensity0.30 – 1 (step 0.1)Frequency of ray sectors
intensityIntensity0.80 – 1 (step 0.1)Ray visibility within sectors
spottySpotty10 – 1 (step 0.1)Density of spots on rays (higher = more spots)
speedSpeed0.50 – 2 (step 0.1)Animation speed of the rays
rayColorRay Color#4283fb—Color of the light rays
backgroundColorBackground Colortransparent—Background color

Every component also takes blendMode · opacity · visible · maskSource/maskType · boundingBox · id

It resembles sunlight breaking through clouds or a stage beam cutting through haze, with rays spreading from one center.

`center` sets the ray origin. Raise `density` within 0–1 for more frequent radial sectors and `intensity` for more visible rays. `spotty` changes the mottled texture along them, while `speed` from 0–2 controls their motion.

Godrays draws its own layer and needs no image input. Place the center near a corner or stage light on a dark background to make the direction clear. Reduce its contrast behind text and important controls.

When to use

Use it for a stage or concert background, a misty or clouded hero, or a scene that needs a focal point. Avoid it in detailed data views or as a strong layer behind text.

Open as page ↗