Hi, I’m trying to learn the new Figure system to combine animated LScenes with contour plots. I generate a curve for the camera eyepos and lookat and values for the plots for each frame. I’ve figured out all of that but now I have this recurring issue where if the surface plots contained in the LScenes change too much in a frame, some other internal threshold in the renderer gets triggered and something about the scene gets resized or otherwise qualitatively changed and it’s really jarring. I’ve attached a rendered .gif example with the two LScenes where they occasionally spaz out gif (~60MB, thank you if you look at it!) . This didn’t happen when I only had one scene, I could create a render that was very smooth.I’ve been trying to mess with a lot of the internal attributes of the various plots and trying to change them from auto to various fixed values, since it seems like it’s triggering some layouting issue and that’s what causes the spaz. But I’m having trouble pinpointing exactly where it might be. Here’s some of the relevant pieces of the code as well (sorry if it’s a little large, I’m not sure which pieces are relevant so I’ll post most of the figure generation/manipulation code):
fig = MakieLayout.Figure(resolution=(1280,1280), title="Iteration 0")
lscene = LScene(fig[2,1], scenekw = (camera = cam3d!, raw=false); height=650, width=450, tellwidth=false, tellheight=false, alignmode=Outside())
surfscene = GLMakie.surface!(lscene, ts, xs, zs[1])
surfaxis = lscene.scene.plots[1]
surfaxis.attributes.names.axisnames[] = ("t", "x", "u")
surfaxis.input_args[1][] = GeometryBasics.HyperRectangle{3,Float32}(Float32[-0.05, -0.05, -1.1], Float32[1.1, 2.1, 2.2])
surfobs = lscene.scene.plots[2].input_args[3]
colsize!(fig.layout, 1, Fixed(500)
lscenediff = LScene(fig[2,2], scenekw = (camera = cam3d!, raw=false); height=650, width=450, tellwidth=false, tellheight=false, alignmode=Outside())
# this continues like above for this lscene
colsize!(fig.layout, 2, Fixed(500))
rowsize!(fig.layout, 2, Fixed(700)
hm_bottom_sublayout = GridLayout()
fig[3,1:2] = hm_bottom_sublayout
hm_bottom_sublayout.height = 300
colorbar = hm_bottom_sublayout[1, 1] = Colorbar(fig, surfscene; width=10)
axiscontour = hm_bottom_sublayout[1, 2] = Axis(fig, title="u vs t-x")
contourscene = GLMakie.contourf!(axiscontour, ts, xs, zs[1])
axiscontour.xlabel="t"
axiscontour.ylabel="x"
contourplot = axiscontour.scene.plots[1]
contourobs = contourplot.input_args[3]
#this continues like above for the second contourf/colorbar
title = fig[1,:] = Label(fig, "Learning Iteration: 0")
rowsize!(fig.layout, 3, Fixed(200))
rowsize!(fig.layout, 1, Fixed(50))
focal_point = [0.5f0, 1.0f0, 0.0f0]
record(fig, video_filename; framerate=24, compression=20) do io
for i in 1:length(parameter_vectors)
cam_position = Float32.(focal_point .+ 1.2 .* [3 * cos(i/30), 4 * sin(i/30), 2.0 + 3.0 * sin(i/50)])
AbstractPlotting.update_cam!(lscene.scene, cam_position, focal_point)
AbstractPlotting.update_cam!(lscenediff.scene, cam_position, focal_point)
imod = ((i - 1) % length(parameter_vectors)) + 1
surfobs.val[:] .= @view zs[imod][:]
contourobs.val[:] .= @view zs[imod][:]
Observables.notify!(surfobs)
Observables.notify!(contourobs)
surfobsdiff.val[:] .= @view diffs[imod][:]
contourdiffobs.val[:] .= @view diffs[imod][:]
Observables.notify!(surfobsdiff)
Observables.notify!(contourdiffobs)
title.elements[:text].text[] = "Learning Iteration: $(i * 10)"
sleep(0.05)
recordframe!(io)
sleep(0.05)
end
end