Open jacobleft opened 1 year ago
Looks like this may be specific to GLMakie - running
using CairoMakie
scene = Scene(backgroundcolor=:gray)
subwindow = Scene(scene, px_area=Rect(100, 100, 200, 200), clear=false, backgroundcolor=:white)
cam3d!(subwindow)
meshscatter!(subwindow, rand(Point3f, 10), color=:gray)
center!(subwindow)
relative_space = Makie.camrelative(subwindow)
lines!(relative_space, Rect(0, 0, 1, 1))
campixel!(scene)
w, h = size(scene)
image!(scene, [sin(i/w) + cos(j/h) for i in 1:w, j in 1:h])
yields this which seems fairly accurate.
In your case, the translation is unnecessary. That is also inconsistent with the docs.
MWE and expected behaviors
According to the
scenes_and_subwindows
section in the docs, after drawing a 3D scene (with an outline)a gradient background 2D image can be added by
Then, a translation is needed to make the 2D image stay behind the 3D scene.
Results
depth_shift = 1
forimage!
, which should adjust the depth value in the clip space, has no effect, either.Workaround
A workaround I found is to adjust the
farclip
value ofcampixel!
which gives a desired plot. But I don't exactly know why this works.