Nebula

성운

A glassy shape filled with billowing nebula gas, dark cavities, glowing cores, and drifting stars.

Also known as: NebulaGas nebulaCosmic nebula

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, Nebula } from 'shaders/react'

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

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

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

export default function ShaderEffect() {
  return (
    <Shader style={{ width: '100%', height: '320px' }} disableTelemetry>
      <Nebula />
    </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: 'Nebula',
    }
  ]
}, { disableTelemetry: true })

Props · Nebula

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

NameValueDefaultRange / optionsDescription
originOriginSet in codecenter—Reference edge the center position is measured from (center default). Lets you pin the shape relative to a corner or the canvas centre.
centerCenter
x0.5y0.5
{"x":0.5,"y":0.5}x, y: 0 – 1Center position of the nebula shape
scaleScale10.1 – 3 (step 0.01)Scale of the nebula shape (1 = default size)
rotationRotation00 – 360 (step 1)Rotation of the nebula shape in degrees
coreColorCore Color#ffd9b0—The hot color the densest gas cores glow with — the embedded newborn stars
gasColorGas Color#ff5e7a—The main emission color of the gas body — H-alpha rose by default
veilColorVeil Color#3a5bdb—The color of the thin outer veils and the deep-space background behind the gas
colorSpaceColor Spaceoklablinear · oklch · oklab · hsl · hsv · lchColor space the veil → gas → core ramps blend in
densityDensity10 – 1 (step 0.01)Optical density of the gas — how strongly clouds occlude the stars and gas behind them
cavityCavity00 – 1 (step 0.01)How hollowed-out the nebula is — 0 fills the volume with cloud banks, high carves large dark voids between them
dustDust0.550 – 1 (step 0.01)Cold dark dust lanes threading the gas — absorb-only tendrils that redden the clouds and stars behind them
gasScaleGas Scale0.40.1 – 1 (step 0.01)Feature size of the gas — higher = finer, busier cloud detail
billowBillow0.60 – 1 (step 0.01)Turbulent folding of the clouds — 0 = smooth drifting banks, 1 = heavily churned billows
glowGlow00 – 2 (step 0.01)Hot emission bloom of the dense cores
seedSeed00 – 100 (step 1)Random seed — pans the gas field to a different region of noise space for a new cloud composition
starsStars0.070 – 1 (step 0.01)Brightness of the star fields drifting at depth behind and inside the gas
starScaleStar Scale10.25 – 3 (step 0.01)Density of the star fields — higher = smaller, busier stars
twinkleTwinkle0.350 – 1 (step 0.01)Intensity of the star twinkle (0 = steady stars, 1 = full shimmer)
refractionRefraction0.50 – 1 (step 0.01)How strongly the curved glass walls bend the interior seen near the edges
environmentEnvironment0.70 – 2 (step 0.01)Strength of the studio softboxes reflected in the polished glass surface
highlightHighlight1.150 – 2 (step 0.01)Sharp key-light glint on the glass
highlightSoftnessHighlight Softness0.50 – 1 (step 0.01)Specular highlight softness — lower is a tighter, sharper glint
lightAngleLight Angle3150 – 360 (step 1)Direction of the key light and reflected studio, in degrees
edgeSoftnessEdge Softness0.050 – 1 (step 0.01)Softness of the shape boundary edge
speedSpeed0.30 – 4 (step 0.01)Speed of the slowly churning gas and twinkling stars. 0 freezes the nebula.
shapeShapeSet in code{"type":"sphere3D","radius":0.35}—Serialized shape configuration (JSON)
shapeSdfUrlshapeSdfUrlSet in code—URL to a pre-generated SDF .bin file
shapeTypeshapeTypeSet in code—Active SDF shape type

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

It feels like a distant nebula sealed inside a glass sphere: gas clouds, dark gaps, hot light, and stars overlap at different depths.

`density` controls how much gas hides stars and clouds behind it; `cavity` changes the dark voids inside the nebula. Raise `gasScale` for finer cloud detail, and `billow` for more turbulent folds. `glow` brightens the hot cores, while `stars` adjusts the star field.

The effect fills its own scene and suits a hero background or large accent. Busy stars and clouds can compete with body text, so give lettering a separate plain backing.

When to use

Use it for a space-themed hero, nebula illustration, or large title accent. Avoid it behind dense data or copy that must remain easy to read.

Open as page ↗