simvx.graphics.renderer.ocean_compute¶
GPU FFT ocean compute chain (design D11, RM-E7gpu).
Moves the per-frame ocean hot path off the CPU: instead of a numpy inverse
FFT + a per-frame texture upload (:class:OceanFFT.evaluate), three compute
shaders run entirely on the GPU each frame, writing straight into the sampled
displacement / slope texture-2D-arrays the ocean shader reads (so ocean.vert
/ ocean.frag are unchanged):
ocean_spectrum.comp– time-evolve the frozenh0spectrum (uploaded once per :meth:OceanFFT.configure) into four packed complex IFFT inputs per cascade (two real fields per complex transform, design D11).ocean_fft.comp– radix-2 Stockham autosort inverse FFT:log2(N)row stages thenlog2(N)column stages, ping-ponging two RGBA32F storage image-2D-arrays (one dispatch per stage covers every cascade + packed field).ocean_assemble.comp– unpack + scale the transforms, fold in choppiness, accumulate the Jacobian folding foam, and write theb2displacement +b3slope arrays the forward ocean pass samples.
Owns the FFT ping-pong images, the static spectrum SSBO and the two output
arrays; :class:OceanPass binds the output views into its render descriptor set.
Reuses the project compute idiom (glslc .comp via
- func:
create_compute_pipeline, storage images, push constants, ping-pong) from the SSR / SSGI / particle passes. Everything here only runs when a visibleOceanSurface3Dis in the scene, so with no ocean the frame is byte-identical.
Module Contents¶
Classes¶
GPU compute FFT: time-evolve + inverse-FFT + assemble the ocean fields. |
Data¶
API¶
- simvx.graphics.renderer.ocean_compute.__all__¶
[‘OceanCompute’]
- simvx.graphics.renderer.ocean_compute.log¶
‘getLogger(…)’
- class simvx.graphics.renderer.ocean_compute.OceanCompute(engine: Any)[source]¶
GPU compute FFT: time-evolve + inverse-FFT + assemble the ocean fields.
Initialization
- resize(fft: simvx.graphics.renderer.ocean_fft.OceanFFT, size: int, cascades: int) None[source]¶
(Re)allocate the size-dependent resources for an
N x N/cascadesocean.Recreates the two complex ping-pong arrays, the two output arrays, the static spectrum SSBO and the descriptor sets, then transitions the images to their steady-state layouts. Foam is reset on the next dispatch (the new output image starts undefined).
- upload_spectrum_if_dirty(fft: simvx.graphics.renderer.ocean_fft.OceanFFT) None[source]¶
Re-upload the frozen static spectrum when :meth:
OceanFFT.configurerebuilt it.
- dispatch(cmd: Any, time: float, choppiness: float, foam_threshold: float, foam_decay: float) None[source]¶
Record the full GPU FFT chain into
cmd(outside any render pass).Evolves the spectrum, runs the Stockham inverse FFT and assembles the displacement / slope arrays, leaving both in
SHADER_READ_ONLY_OPTIMALready for the forward ocean pass to sample. Must be called after- Meth:
upload_spectrum_if_dirtyand only when a visible ocean exists.