Divooka Reference

Ocean

15 nodes

On this page 15

Add Ocean Body

Function

The sea with a rigid body on it, made by the Box, Sphere, Capsule and the other body nodes. A body lighter than the water (1025 kg/m³) floats and rides the waves, drifts with them and is turned by them; a heavier one sinks. Bodies collide with each other. They do not disturb the sea.

Signature
AddOceanBody -> Ocean Scene Description
    scene: Ocean Scene Description
    body: Body Description
OceanSceneDescription AddOceanBody(
    OceanSceneDescription scene,
    BodyDescription body)

Parameters

nametypedefaultdescription
sceneOcean Scene Description—The sea.
bodyBody Description—The body; put it at about the sea's level, since one let go from high up plunges before it settles.

Returns

resultOcean Scene Description
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Ocean
Package
Physics Simulation

Add Ocean Trigger

Function

The sea with a trigger for its bodies, made by the Triggers nodes: at a time, at every interval, or when a body touches another, rises or falls past a height or moves faster than a speed, it pushes a body, releases one that was held, spawns a copy of one or removes one. Cargo going over the side one crate at a time, a buoy let go. Triggers are looked at after every step of the bodies, in the order they were added; what they did is in the events of Simulate Ocean's result. A sea does not take Water In Region, Detonate, Set Wind or Unpin Cloth, and says so here.

Signature
AddOceanTrigger -> Ocean Scene Description
    scene: Ocean Scene Description
    trigger: Trigger Description
OceanSceneDescription AddOceanTrigger(
    OceanSceneDescription scene,
    TriggerDescription trigger)

Parameters

nametypedefaultdescription
sceneOcean Scene Description—The sea.
triggerTrigger Description—The trigger.

Returns

resultOcean Scene Description
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Ocean
Package
Physics Simulation

Export Ocean Meshes

Function

Writes the sea's surface over a rectangle at every frame of a span of time as a mesh file, in metres and Divooka's axes (+Z up). Returns the files written.

Signature
ExportOceanMeshes -> Text Array
    scene: Ocean Scene Description
    folder: Text
    center: Vector3d
    Size X: Number
    Size Y: Number
    cells: Integer
    duration: Number
    framesPerSecond: Number
    prefix: Text
    format: Text
string[] ExportOceanMeshes(
    OceanSceneDescription scene,
    string folder,
    Vector3d center,
    double sizeX = 100,
    double sizeY = 100,
    int cells = 256,
    double duration = 2,
    double framesPerSecond = 24,
    string prefix = "ocean",
    string format = "ply")

Parameters

nametypedefaultdescription
sceneOcean Scene Description—The sea.
folderText—The folder; created if missing.
centerVector3d—The rectangle's middle (m).
Size XNumber100Its extent along X (m).
Size YNumber100Its extent along Y (m).
cellsInteger256Cells along its longer side.
durationNumber2How long to run (s).
framesPerSecondNumber24Frames per second.
prefixTextoceanFile name prefix: files are prefix.0001.ply and on.
formatTextplyThe file format: ply (binary, the smallest), obj or stl.

Returns

resultText Array
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Ocean
Package
Physics Simulation

Export Ocean Textures

Function

Writes the sea's textures over a span of time: for every frame and each of the three patches a displacement map (OpenEXR, 16-bit floats, metres), a normal map and a foam mask (PNG), named prefix.patch.kind.frame, and one text file saying what tiles at what size and how the channels are meant. For a sea made with a loop time, run that long and the last frame leads back into the first. Returns the files written.

Signature
ExportOceanTextures -> Text Array
    scene: Ocean Scene Description
    folder: Text
    duration: Number
    framesPerSecond: Number
    prefix: Text
string[] ExportOceanTextures(
    OceanSceneDescription scene,
    string folder,
    double duration = 4,
    double framesPerSecond = 15,
    string prefix = "ocean")

Parameters

nametypedefaultdescription
sceneOcean Scene Description—The sea.
folderText—The folder; created if missing.
durationNumber4How long to run (s).
framesPerSecondNumber15Frames per second.
prefixTextoceanFile name prefix.

Returns

resultText Array
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Ocean
Package
Physics Simulation

New Ocean

Function

A sea raised by a wind, by the JONSWAP spectrum of a wind blowing over a hundred kilometres of water. It is worked out on three square patches that each repeat, the largest of the given size and the others a fifth and a thirtieth of it, summed: long swell, waves and ripples.

Signature
NewOcean -> Ocean Scene Description
    Wind Speed (m/s): Number
    Wind Direction (°): Number
    size: Number
    resolution: Integer
    choppiness: Number
    seed: Integer
    loop: Number
OceanSceneDescription NewOcean(
    double windSpeed = 10,
    double windDirection = 0,
    double size = 500,
    int resolution = 256,
    double choppiness = 1.1,
    int seed = 1,
    double loop = 0)

Parameters

nametypedefaultdescription
Wind Speed (m/s)Number10The wind's speed (m/s): 5 is a breeze, 10 a fresh wind with whitecaps, 20 a gale with waves metres high.
Wind Direction (°)Number0Where the wind blows to, in degrees from +X towards +Y.
sizeNumber500The side (m) of the largest patch: the sea repeats beyond it, and its longest waves are shorter than it. A few hundred metres for an open sea, some tens for a close view of a light wind.
resolutionInteger256Texels along a side of each patch: 64, 128, 256, 512 or 1024.
choppinessNumber1.1How much the crests are sharpened: 0 a rolling swell, 1 as the theory has it, 1.3 folding into whitecaps.
seedInteger1Another seed is another sea of the same wind.
loopNumber0Make the sea repeat itself exactly after this time (s), for textures a game plays in a loop; 0: it never repeats.

Returns

resultOcean Scene Description
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Ocean
Package
Physics Simulation

Ocean Displacement Map

Function

One patch of the sea at a time as a displacement texture that tiles: per texel how far the water there has moved from where it rests, in metres, as a floating-point picture whose red is the shift along X, green along Y and blue the height (Z). Columns run along +X and rows along +Y, the patch's corner at the origin. A game moves the vertices of a flat grid by the sum of the three patches, each repeated at its own size. Made on the graphics card.

Signature
OceanDisplacementMap -> Hdr Pixel Image
    scene: Ocean Scene Description
    time: Number
    patch: Integer
HdrPixelImage OceanDisplacementMap(
    OceanSceneDescription scene,
    double time,
    int patch = 0)

Parameters

nametypedefaultdescription
sceneOcean Scene Description—The sea.
timeNumber—The time (s).
patchInteger0The patch, 0 (largest) to 2.

Returns

resultHdr Pixel Image
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Ocean
Package
Physics Simulation

Ocean Foam Map

Function

One patch of the sea at a time as a foam mask that tiles: white where that patch's crests are sharp, and fainter where they have just been. A breeze leaves almost none; from about 7 m/s of wind there are whitecaps, and more the harder it blows. Made on the graphics card.

Signature
OceanFoamMap -> Pixel Image
    scene: Ocean Scene Description
    time: Number
    patch: Integer
PixelImage OceanFoamMap(
    OceanSceneDescription scene,
    double time,
    int patch = 0)

Parameters

nametypedefaultdescription
sceneOcean Scene Description—The sea.
timeNumber—The time (s).
patchInteger0The patch, 0 (largest) to 2.

Returns

resultPixel Image
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Ocean
Package
Physics Simulation

Ocean Height

Function

The sea's height (m) over a point at a time.

Signature
OceanHeight -> Number
    scene: Ocean Scene Description
    time: Number
    position: Vector3d
double OceanHeight(
    OceanSceneDescription scene,
    double time,
    Vector3d position)

Parameters

nametypedefaultdescription
sceneOcean Scene Description—The sea.
timeNumber—The time (s).
positionVector3d—The point; its Z is not used.

Returns

resultNumber
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Ocean
Package
Physics Simulation

Ocean Normal Map

Function

One patch of the sea at a time as a normal map that tiles: per texel the direction the surface faces, red and green the lean along X and Y and blue the up, each as 0.5 + 0.5 × component, the way normal maps are stored. Made on the graphics card.

Signature
OceanNormalMap -> Pixel Image
    scene: Ocean Scene Description
    time: Number
    patch: Integer
PixelImage OceanNormalMap(
    OceanSceneDescription scene,
    double time,
    int patch = 0)

Parameters

nametypedefaultdescription
sceneOcean Scene Description—The sea.
timeNumber—The time (s).
patchInteger0The patch, 0 (largest) to 2.

Returns

resultPixel Image
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Ocean
Package
Physics Simulation

Ocean Patch Size

Function

The side (m) of one of the sea's three patches: 0 is the largest (the swell), 2 the smallest (the ripples). Each patch's textures tile at this size.

Signature
OceanPatchSize -> Number
    scene: Ocean Scene Description
    patch: Integer
double OceanPatchSize(
    OceanSceneDescription scene,
    int patch = 0)

Parameters

nametypedefaultdescription
sceneOcean Scene Description—The sea.
patchInteger0The patch, 0 to 2.

Returns

resultNumber
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Ocean
Package
Physics Simulation

Ocean Picture

Function

A picture of the sea at a time, with the bodies on it where the waves have taken them by then, under the scene's sun. Made on the graphics card.

Signature
OceanPicture -> Pixel Image
    scene: Ocean Scene Description
    time: Number
    eye: Vector3d
    target: Vector3d
    width: Integer
    height: Integer
    fieldOfView: Number
PixelImage OceanPicture(
    OceanSceneDescription scene,
    double time,
    Vector3d eye,
    Vector3d target,
    int width = 640,
    int height = 480,
    double fieldOfView = 40)

Parameters

nametypedefaultdescription
sceneOcean Scene Description—The sea.
timeNumber—The time (s).
eyeVector3d—Where the camera stands (m): a few metres above the water for a view from a deck.
targetVector3d—What it looks at (m).
widthInteger640The picture's width in pixels.
heightInteger480The picture's height in pixels.
fieldOfViewNumber40The camera's vertical field of view in degrees.

Returns

resultPixel Image
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Ocean
Package
Physics Simulation

Ocean Surface

Function

The sea's surface over a rectangle at a time, as a mesh: an open sheet whose vertices move with the water, sideways as well as up, so that crests are sharp. The 3D view draws it; it is the sea a renderer wants for a still or, a mesh per frame, for a shot.

Signature
OceanSurface -> Streamed Vertex Mesh Data
    scene: Ocean Scene Description
    time: Number
    center: Vector3d
    Size X: Number
    Size Y: Number
    cells: Integer
StreamedVertexMeshData OceanSurface(
    OceanSceneDescription scene,
    double time,
    Vector3d center,
    double sizeX = 100,
    double sizeY = 100,
    int cells = 256)

Parameters

nametypedefaultdescription
sceneOcean Scene Description—The sea.
timeNumber—The time (s).
centerVector3d—The rectangle's middle (m); its Z is not used.
Size XNumber100Its extent along X (m).
Size YNumber100Its extent along Y (m).
cellsInteger256Cells along its longer side: 256 is 65 thousand vertices.

Returns

resultStreamed Vertex Mesh Data
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Ocean
Package
Physics Simulation

Ocean Wave Height

Function

The significant wave height of the sea (m): the mean height, trough to crest, of the highest third of its waves, which is about what an observer would call the height of the waves.

Signature
OceanWaveHeight(scene: Ocean Scene Description) -> Number
double OceanWaveHeight(OceanSceneDescription scene)

Parameters

nametypedefaultdescription
sceneOcean Scene Description—

Returns

resultNumber
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Ocean
Package
Physics Simulation

Set Ocean Sun

Function

The sea under another sun.

Signature
SetOceanSun -> Ocean Scene Description
    scene: Ocean Scene Description
    sunDirection: Vector3d
OceanSceneDescription SetOceanSun(
    OceanSceneDescription scene,
    Vector3d sunDirection)

Parameters

nametypedefaultdescription
sceneOcean Scene Description—The sea.
sunDirectionVector3d—Where the sun stands, as a direction towards it: a low sun ahead of the camera puts a path of light on the water.

Returns

resultOcean Scene Description
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Ocean
Package
Physics Simulation

Simulate Ocean

Function

Runs the sea with the bodies on it and records their motion: a result the Results nodes read (Body Position, Body Path, Bodies Mesh) and the 3D view plays. The same sea gives the same motion bit for bit, on any machine. The sea itself needs no recording: Ocean Surface gives it at any of the run's times.

Signature
SimulateOcean -> Simulation Result
    scene: Ocean Scene Description
    duration: Number
    framesPerSecond: Number
SimulationResult SimulateOcean(
    OceanSceneDescription scene,
    double duration = 5,
    double framesPerSecond = 30)

Parameters

nametypedefaultdescription
sceneOcean Scene Description—A sea with bodies on it.
durationNumber5How long to run (s).
framesPerSecondNumber30Frames per second of the recording.

Returns

resultSimulation Result
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Ocean
Package
Physics Simulation