eulerjs API / @eulerjs/marine/webgpu / GpuWaveFields
GpuWaveFields
Defined in: packages/marine/src/webgpu/GpuWaveFields.ts:85
The full sea of a SpectralWaves, every wave of every patch, evaluated on the GPU each frame with the same inverse FFT the physics does on the CPU (waves/fft.ts): one render pass to turn the spectra on to the frame's time, one per stage of the transform's rows and of its columns, and one per patch to unpack the result into textures the water's material samples.
The patches lie side by side in one atlas, so each pass does them all, and each texel carries four complex fields in two render targets: the eight real fields height, sideways x and z, the height's slopes and the sideways motion's gradients, two to a complex field.
Render passes rather than compute shaders, so the same code runs on WebGPU and on WebGPURenderer's WebGL 2 fallback, which has neither workgroup memory nor storage textures.
Constructors
Constructor
new GpuWaveFields(waves, options?): GpuWaveFields;Defined in: packages/marine/src/webgpu/GpuWaveFields.ts:142
Parameters
| Parameter | Type |
|---|---|
waves | SpectralWaves |
options? | GpuWaveFieldsOptions |
Returns
GpuWaveFields
Properties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
choppinessNode | readonly | any | The waves' choppiness, as the transform has it: for the swell's sideways motion too. | packages/marine/src/webgpu/GpuWaveFields.ts:103 |
foamPhase | readonly | UniformNode<"float", number> | Which of each patch's two foam textures is the newer: 0 or 1. | packages/marine/src/webgpu/GpuWaveFields.ts:93 |
foamSettings | readonly | object | Settings of the foam that can change as it runs: set their value. | packages/marine/src/webgpu/GpuWaveFields.ts:108 |
foamSettings.bias | public | object | - | packages/marine/src/webgpu/GpuWaveFields.ts:108 |
foamSettings.bias.value | public | number | - | packages/marine/src/webgpu/GpuWaveFields.ts:108 |
foamSettings.decay | public | object | - | packages/marine/src/webgpu/GpuWaveFields.ts:108 |
foamSettings.decay.value | public | number | - | packages/marine/src/webgpu/GpuWaveFields.ts:108 |
foamSettings.growth | public | object | - | packages/marine/src/webgpu/GpuWaveFields.ts:108 |
foamSettings.growth.value | public | number | - | packages/marine/src/webgpu/GpuWaveFields.ts:108 |
foamSettings.peakLift | public | object | - | packages/marine/src/webgpu/GpuWaveFields.ts:108 |
foamSettings.peakLift.value | public | number | - | packages/marine/src/webgpu/GpuWaveFields.ts:108 |
gustiness | readonly | UniformNode<"float", number> | How much the gusting patches' waves are scaled from place to place: as SpectralWaves.gustAt. | packages/marine/src/webgpu/GpuWaveFields.ts:106 |
passCount | readonly | number | Render passes a frame: for the comparisons in the ocean example. | packages/marine/src/webgpu/GpuWaveFields.ts:91 |
patches | readonly | readonly FieldPatch[] | - | packages/marine/src/webgpu/GpuWaveFields.ts:88 |
resolution | readonly | number | - | packages/marine/src/webgpu/GpuWaveFields.ts:87 |
swell | readonly | object[] | The swell's long waves, which no patch holds, each (kx, kz, amplitude, phase): its wavenumber along its way, how high it is, and its phase this frame, worked out on the CPU in double precision. Summed where they are, as SpectralWaves sums them for the physics. | packages/marine/src/webgpu/GpuWaveFields.ts:101 |
textures | readonly | WaveFieldTextures | - | packages/marine/src/webgpu/GpuWaveFields.ts:89 |
waveHeight | readonly | UniformNode<"float", number> | The sea's significant wave height, Hs, in metres: for gauging how near a crest the surface stands. | packages/marine/src/webgpu/GpuWaveFields.ts:95 |
waves | readonly | SpectralWaves | - | packages/marine/src/webgpu/GpuWaveFields.ts:86 |
Accessors
atlas
Get Signature
get atlas(): RenderTarget;Defined in: packages/marine/src/webgpu/GpuWaveFields.ts:318
The transform's result for every patch before unpacking, as evaluateFields lays it out on the CPU: for checking one against the other.
Returns
RenderTarget
Methods
dispose()
dispose(): void;Defined in: packages/marine/src/webgpu/GpuWaveFields.ts:322
Returns
void
gustAt()
gustAt(grid): any;Defined in: packages/marine/src/webgpu/GpuWaveFields.ts:244
How much the gusting patches' waves are scaled by at the undisplaced grid position grid (vec2), as SpectralWaves.gustAt works it out.
Parameters
| Parameter | Type |
|---|---|
grid | any |
Returns
any
gusts()
gusts(patchIndex): boolean;Defined in: packages/marine/src/webgpu/GpuWaveFields.ts:251
Whether a patch's waves gust.
Parameters
| Parameter | Type |
|---|---|
patchIndex | number |
Returns
boolean
update()
update(renderer, time): void;Defined in: packages/marine/src/webgpu/GpuWaveFields.ts:256
Evaluates the sea at time, the same time the physics is given, into patches' textures.
Parameters
| Parameter | Type |
|---|---|
renderer | Renderer |
time | number |
Returns
void
