Skip to content

scale! is inconsistently applied to campixel and background axis for LScene #5547

@moyner

Description

@moyner
  • [Makie 0.24.8 / GLMakie 0.13.8] what version of Makie are you running? (]st -m Makie)
  • [Yes] can you reproduce the bug with a fresh environment ? (]activate --temp; add Makie)
  • [Tested on macOS and Windows 11] What platform + GPU are you on?
  • [GLMakie] Which backend are you using? (GLMakie, CairoMakie, WGLMakie, RPRMakie)
  • [] Please provide an minimal example of the failing code. If the problem is with the visualization, please provide a picture or video of it.

There seems to be a couple of issues with the scaling for LScene. I could be doing this the wrong way, though, but I have some workflows where scaling is used and this popped up. Two examples:

Scaling of background mesh

using GLMakie
using GLMakie.GeometryBasics

c = Cylinder(Point3f(-1, 0, 0), Point3f(0, 0, 1), 0.3f0)
fig, ax, plt = mesh(c)
ax2 = LScene(fig[1, 2])
mesh!(ax2, c)
scale!(ax2.scene, 1.0, 1.0, 3.0)
fig
Image

Campixel subscene

c = Cylinder(Point3f(-1, 0, 0), Point3f(0, 0, 1), 0.3f0)
fig, ax1, plt = mesh(c)
ax2 = LScene(fig[1, 2])
mesh!(ax2, c)
for ax in [ax1, ax2]
    bgscene = Scene(ax.scene)
    campixel!(bgscene)
    w, h = size(bgscene) # get the size of the scene in pixels
    # this draws a line at the scene window boundary
    bg = [sin(i/w) + cos(j/h) for i in 1:w, j in 1:h]
    bg_plt = image!(bgscene, [0.5*i/w + (1.0 - (j/h)^1.5) for i in 1:w, j in 1:h],
        colormap = :viridis,
        colorrange = (minimum(bg), maximum(bg))
    )
    translate!(bg_plt, 0, 0, -10000)
end
# Every so slightly scale axis2
scale!(ax2.scene, 1.0, 1.0, 1.0001)
fig

In this case, the background disappears whenever scaling is used. Re-drawing it after scaling does not seem to help.

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions