Animate Makie.volume! doesn't work

Hey all, assume I have a time-varying 3d volume that I wish to animate and save as an mp4 file, where the volume is simply a color-coded cube, where the color coding is the value of each pixel varying in time. I found no correct syntax or good example to draw inspiration from, except for a futile attempt to make CairoMakie.record work.
I’d appreciate some aid with this!

Thanks in advance,

Gidi

Hi,
CairoMakie doesn’t support volume rendering.
You need to use GLMakie.
Animating that should just work like any other plot type, so without any more information it’s hard to see where you got stuck (besides the backend problem).

Hey, thanks for the prompt reply!

I figured as much and switched to GLMakie. I cannot add a link here, but should you search Youtube for “Oceananigans Deep convection”, you’ll see the perfect example of how I’d like animate this volume, where the desired x-axis coordinate being some variable.

Many thanks again,

G.

What have you tried so far? The animation examples in the docs should map to volume, just with different input data

GLMakie should be the way to go…here’s a quick example:

using GLMakie

n = 50
xrange = range(0, 2pi, n)
yrange = range(0, 2pi, n)
zrange = range(0, pi, n)

f = [sin(x) * cos(y) + sqrt(z) for x in xrange, y in yrange, z in zrange]

t = Observable(0.)

ft = @lift(f .* tan($t))

fig = Figure()

ax = Axis3(
    fig[1,1],
)

volume!(xrange, yrange, zrange, ft, colormap = :inferno, colorrange = extrema(f), transparency =true)

fig

record(fig, "volumes.gif", range(0, pi, 120); framerate = 12) do frame
    t[] = frame
end

volumes