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
          • Default Usage
          • Interaction
          • Props
          • Presets
          • Notes
      • Sky & Atmosphere

        • Sky Dome
        • 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

Component

A first-person dawn beach walk. The island is a 260 m ring, and the sand height, the wet band, the ocean swells and the footprints all share one set of shore coordinates, so the waterline, the walker and the shader stay aligned at every angle. A single fullscreen ray-march evaluates the sand heightfield and the wave surface in one TSL pass, then tone-maps the result with an ACES curve — the WebGPU and the WebGL renderer compile the same shader and produce the same image. Only sand and water are shaded: rays that miss both are filled with the Scene background colour, so the canvas stays opaque.

Drag to look around, walk with WASD or the arrow keys, and scroll to take a step forward. Footprints are written into a small ring buffer and washed away by the tide.

Default Usage

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

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

Interaction

  • Drag turns the camera. The look drag is captured on the canvas, so the page does not scroll while you look around.
  • W / A / S / D or the arrow keys walk across the sand. Keyboard input only applies while the pointer is over the canvas.
  • Wheel takes a step forward with a short impulse instead of a continuous zoom.
  • The walker stays inside the beach ring, so the camera can never walk into the ocean or climb the inland slope.

Props

NameTypeDefaultDescription
preset'sunrise' | 'morning' | 'sunset' | 'night' | 'blueHour''sunrise'optional Time-of-day preset. Changing it cross-fades the sun, water and sand colours.
autoWalkbooleanfalseoptional Walk forward automatically, useful for an attract-mode background.
crouchingbooleanfalseoptional Lower the camera to a crouched eye height.
interactivebooleantrueoptional Attach pointer look, WASD / arrow keys and wheel stepping to the canvas.

Presets

PresetDescription
sunriseWarm low sun, peach-tinted shallows and long soft shadows on the sand
morningHigh sun, bright turquoise shallows and pale dry sand
sunsetVery low sun behind the water, an orange glitter path and violet-tinted sand
nightCool moonlight over dark water and muted sand
blueHourSun just below the horizon, pink light on dim blue water

Notes

  • The component owns the camera while it is mounted. It saves the previous camera pose, field of view and near/far planes, disables the scene's OrbitControls, and restores all of them on unmount.
  • The beach is drawn by one fullscreen TSL shader on an inside-out sphere: it sphere-traces the sand, intersects the animated wave surface, and shades whichever hit is nearer, including depth-absorbed shallows, foam, wet sand and footprints. Rays that miss both hits are filled with the Scene background colour, keeping the canvas opaque and consistent across both renderers.
  • Every geometry, material, texture and event listener is disposed on unmount.
  • Changing a prop updates the running scene in place; it never rebuilds the beach.
Edit this page on GitHub
Last Updated:
Contributors: Shing Rui, ruixinglong
Prev
Water Pool