Three Vue3Three Vue3
Guide
Demo
AI Agents
  • English
  • 简体中文
GitHub
Guide
Demo
AI Agents
  • English
  • 简体中文
GitHub
    • Getting Started
    • Scene
    • Parameter Bus
    • SkyBox
    • Model Loader

      • Component Loader
      • Function Loader
    • Popup
    • Callout
    • Movable Element
    • Animation
    • Model Rotator
    • Picker
    • Fit Camera
    • Mesh

      • Wave Circle Mesh
      • Flow Line Mesh
    • Effect

      • Nature

        • Rain
        • Snow
        • Water
        • Water Pool
        • Sandy Beach
      • Sky & Atmosphere

        • Sky Dome
          • Default Usage
          • Options
          • Methods
        • HeightFog
        • Nebula Galaxy
      • Light

        • Bloom
        • Sweep Light
        • Light Gradient
        • Light Pillar
        • Radar Sweep
        • Signal Wave
        • Force Shield
      • Particles & Sprites

        • Fireworks
        • Text Fireworks
        • Glow Sprite
    • GIS

      • Geographic Reference
      • GeoObject
      • GeoJsonLayer
      • Tile Layer

type

Class

SkyDome is a gradient sky sphere with a low sun: four color bands rising from the horizon to the zenith, a wide halo, and a round sun disc. It is built with a TSL node material, so the same class runs on the WebGPU renderer and on WebGL through WebGLNodesHandler.

When no sunDirection is passed, the dome follows globalParameterBus, so moving the shared sun updates the sky automatically.

Default Usage

Click me to view the codes
<template>
  <tv-scene class="scene" bg-color="rgb(40, 42, 54)" @created="created"></tv-scene>
</template>

<script lang="ts" setup>
import { onBeforeUnmount } from 'vue'
import * as THREE from 'three'
import { SkyDome, globalParameterBus } from 'three-vue3'

let dome: SkyDome | undefined

const created = (scene, { camera }) => {
  camera.position.set(0, 0.8, 7)
  camera.lookAt(0, 0.8, 0)

  // One shared sun direction drives every effect in the scene.
  globalParameterBus.set('sunDirection', new THREE.Vector3(-0.78, 0.2, -0.6))

  dome = new SkyDome()
  scene.add(dome)
}

onBeforeUnmount(() => {
  dome?.dispose()
  dome = undefined
})
</script>

<style>
.scene {
  margin-top: 10px;
  margin-bottom: 16px;
  width: 100%;
  height: 300px;
}
</style>

Options

NameTypeDefaultDescription
radiusnumber420optional Radius of the dome sphere.
horizonColornumber0xf27536optional Color of the band on the horizon.
lowerSkyColornumber0x803624optional Color just above the horizon.
upperSkyColornumber0x260f13optional Color of the intermediate band.
zenithColornumber0x060409optional Color at the top of the dome.
sunDirection[number, number, number]from the parameter busoptional Sun direction, normalized internally.
glowColornumber0xff9947optional Color of the halo around the sun.
sunColornumber0xffe0b8optional Color of the sun disc.
sunIntensitynumber2.4optional Brightness multiplier of the sun disc.
sunSizenumber10optional Angular diameter of the disc, in degrees.
segmentsnumber48optional Horizontal segment count of the sphere.

Methods

NameParametersDescription
setSunDirection(direction: THREE.Vector3 | [number, number, number]) => voidPoints the dome at a new sun direction.
dispose() => voidUnsubscribes and releases geometry/material.
Edit this page on GitHub
Last Updated:
Contributors: Shing Rui
Next
HeightFog