The (background)color of Box always covers the 3D LScene.scene.backgroundcolor, and the latter cannot be changed

Cannot create a layout that a 3D-LScene with a colorful background placed over a Box placeholder filled with another colorful background.

This post point out 2 problems:

  • the display sequence of Box’s :color is always priorior to LScene.scene.backgroundcolor
  • CANNOT change the background(either black or white) of a 3D plot in LScene

Some posts related to the 2nd problem:

Codes below are modified from How to draw boxes around subfigures | Makie

# https://docs.makie.org/v0.21/how-to/draw-boxes-around-subfigures

using GLMakie
GLMakie.activate!()
# using WGLMakie
# WGLMakie.activate!()
# using CairoMakie
# CairoMakie.activate!()
f = Figure(size=(1920, 1080),)

# g12 = 
g1 = GridLayout(f[1, 1], width=200, height=650, alignmode=Outside(15))
g2 = GridLayout(f[1, 2], width=200, height=650, alignmode=Outside(15))
box1 = Box(f[1, 1], cornerradius=10, color=(:tomato, 0.5), strokecolor=:transparent)
box11 = Box(g1[1, 1], cornerradius=10, color=(:tomato, 1), strokecolor=:transparent)
box2 = Box(f[1, 2], cornerradius=10, color=(:teal, 0.5), strokecolor=:transparent)

# move the boxes back so the Axis background polys are in front of them
Makie.translate!(box1.blockscene, 0, 0, -100)
Makie.translate!(box2.blockscene, 0, 0, -100)

ax11 = LScene(g1[1, 1])
# Makie.translate!(ax11.scene, 0, 0, 100)
Axis(g1[2, 1])
Axis(g1[3, 1], backgroundcolor=:white)

# Box(f[1, 1], cornerradius=10, color=(:tomato, 0.5), strokecolor=:transparent)
# Makie.translate!(box1.blockscene, 0, 0, -1)
# ax11.scene.clear=true
ax11.blockscene.backgroundcolor = RGBAf(0,0,1,0.5)
Makie.translate!(ax11.blockscene, 0, 0, 1)
# ax11.scene.attributes[:background] = :purple

Axis(g2[1, 1])
Axis(g2[2, 1])
Axis(g2[3, 1])

line_width = 2.0f0
circle_size = 40.0f0

# 添加 起点终点 所决定的 箭头
e0 = Point3f(0, 0, 0)
ex = Point3f(1, 0, 0)  # x轴正方向
ey = Point3f(0, 1, 0)  # y轴正方向
ez = Point3f(0, 0, 1)  # z轴正方向

arrow_head_branch = 0.1f0  # 使用浮点数后缀 f0 来指定 Float32 类型
e_x = Point3f(arrow_head_branch, 0, 0)  # x轴正方向
e_y = Point3f(0, arrow_head_branch, 0)  # y轴正方向
e_z = Point3f(0, 0, arrow_head_branch)  # z轴正方向

linesegments!(ax11, [e0, ex], color=[:red, :red], linewidth=line_width)
linesegments!(ax11, [e0, ey], color=[:green, :green], linewidth=line_width)
linesegments!(ax11, [e0, ez], color=[:blue, :blue], linewidth=line_width)

linesegments!(ax11, [e0, ex], color=[:red, :red], linewidth=line_width)
linesegments!(ax11, [e0, ey], color=[:green, :green], linewidth=line_width)
linesegments!(ax11, [e0, ez], color=[:blue, :blue], linewidth=line_width)
scatter!(ax11, ex, color=:red, markersize=circle_size)
scatter!(ax11, -ex, color=(:red, 0), markersize=circle_size - line_width * 3.0f0,
    strokewidth=line_width, strokecolor=:red)

scatter!(ax11, ey, color=:green, markersize=circle_size)
scatter!(ax11, -ey, color=(:green, 0), markersize=circle_size - line_width * 3.0f0,
    strokewidth=line_width, strokecolor=:green)

scatter!(ax11, ez, color=:blue, markersize=circle_size)
scatter!(ax11, -ez, color=(:blue, 0), markersize=circle_size - line_width * 3.0f0,
    strokewidth=line_width, strokecolor=:blue)

# ax11.scene.attributes[:background] = :black  # 设置为黑色背景
# ax11.scene.clear = true  # 确保清除背景以应用颜色
# Makie.translate!(a.scene, 0, 0, 100)

# DataInspector(scene = current_figure())

Label(f[0, :], "Two boxes indicate groups of axes that belong together")

f

There’s a 3D LScene behind the first subplot: can we display it in the front/first layer?