Skip to content

Ocean

<Ocean /> is a wrapper for the Three.js Water add-on.

WARNING

<Ocean /> comes with a default texture, so it needs to be wrapped in a Suspense component.

Usage

SKY

<Ocean /> works hand in hand with the Sky component, detecting the position of the sun and reflecting on the water. (<Sky /> is not required for making this component work.)

Fog

The <Ocean /> component also reacts when there's Fog or FogExp2 in your scene.

Custom Geometry

You can use custom geometry by adding it as a child.

HTML
<Suspense>
  <Ocean>
    <TresCircleGeometry :args="[50, 16]" />
  </Ocean>
</Suspense>

Props

WARNING

All of the props of this component are not reactive.

PropDescriptionDefault
textureWidthWidth of the mirror texture512
textureHeightHeight of the mirror texture512
waterNormalsNormals of the waterhttps://raw.githubusercontent.com/Tresjs/assets/main/textures/water-normals/Water_1_M_Normal.jpg
sunDirectionSun direction to be reflected on the waterVector3(0,0,0)
sunColorSun color to be reflected on the water0xffffff
waterColorWater Color0x001e0f
distortionScaleDistortion scale on reflected objects3.7
sizeSize of the water normals1
clipBiasTo use the clipBias property0.0
alphaTo use the clipBias Alpha1.0
sideWhich size of the mesh will render the waterFrontSide