EventDispatcher → Object3D → Mesh →

# WaterMesh

A basic flat, reflective water effect.

Note that this class can only be used with WebGPURenderer. When using WebGLRenderer, use Water.

References:

- Flat mirror for three.js
- An implementation of water shader based on the flat mirror
- Water shader explanations in WebGL

## Import

WaterMesh is an addon, and must be imported explicitly, see Installation#Addons.

    import { WaterMesh } from 'three/addons/objects/WaterMesh.js';

## Constructor

### new WaterMesh ( geometry : BufferGeometry, options : WaterMesh~Options )

Constructs a new water mesh.

geometry | The water mesh's geometry.
options | The configuration options.

## Properties

### .alpha : UniformNode.<float>

The alpha value.

Default is `1`.

### .distortionScale : UniformNode.<float>

The distortion scale.

Default is `20`.

### .isWaterMesh : boolean (readonly)

This flag can be used for type testing.

Default is `true`.

### .resolutionScale : number

The effect's resolution scale.

Default is `0.5`.

### .size : UniformNode.<float>

The size value.

Default is `1`.

### .sunColor : UniformNode.<color>

The sun color.

Default is `0xffffff`.

### .sunDirection : UniformNode.<vec3>

The sun direction.

Default is `(0.70707,0.70707,0.0)`.

### .waterColor : UniformNode.<color>

The water color.

Default is `0x7f7f7f`.

### .waterNormals : TextureNode

The water's normal map.

## Type Definitions

### .Options

Constructor options of `WaterMesh`.

resolutionScale number | The resolution scale. Default is `0.5`.
waterNormals Texture | The water's normal map. Default is `null`.
alpha number | The alpha value. Default is `1`.
size number | The size value. Default is `1`.
sunColor number | Color | string | The sun color. Default is `0xffffff`.
sunDirection Vector3 | The sun direction. Default is `(0.70707,0.70707,0.0)`.
waterColor number | Color | string | The water color. Default is `0x7F7F7F`.
distortionScale number | The distortion scale. Default is `20`.

## Source

examples/jsm/objects/WaterMesh.js