Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WGLMakie plot of a PyramdScheme flickers on zoom and pan #3776

Open
2 tasks
felixcremer opened this issue Apr 8, 2024 · 2 comments
Open
2 tasks

WGLMakie plot of a PyramdScheme flickers on zoom and pan #3776

felixcremer opened this issue Apr 8, 2024 · 2 comments
Labels
bug interaction WGLMakie This relates to WGLMakie.jl, the Web-based WebGL backend for Makie.

Comments

@felixcremer
Copy link
Contributor

felixcremer commented Apr 8, 2024

  • [x ] are you running newest version (version from docs) ?
    WGLMakie 0.9.9 and Makie 0.20.9
    And on PyramidScheme master
  • can you reproduce the bug with a fresh environment ? (]activate --temp; add Makie)
  • What platform + GPU are you on?

When I try to plot a Pyramid from PyramidScheme.jl the plot in WGLMakie flickers when I zoom in or pan around the data see the screencast attached. The following code highlights the problem but it is also visible with pure random data.
Plotting the data directly without PyramidScheme fails with a WebGL error; Out of memory
Also Ctrl + left click only slightly shifts the limits and does not return to the original limits.

using WGLMakie, DimensionalData
using PyramidScheme: PyramidScheme as PS

julia> mandelbrot_set!(img, -2.0,0.5,-1.25,1.25, npoints)^C

julia> function mandelbrot(c, b, itmap)
           z = c
           for n in 1:b
               if z.re * z.re + z.im * z.im > 4
                   return itmap(n, z, b)
               end
               z = z^2 + c
           end
           return 0.0
       end
mandelbrot (generic function with 1 method)

julia> function mandelbrot_set!(img, xi, xf, yi, yf, npoints; b=1024)
           for (i,x) in enumerate(range(xi, xf, length=npoints))
               for (j,y) in enumerate(range(yi, yf, length=npoints))
                   color = mandelbrot(x + 1im*y, b, normIterations)
                   img[i,j] = color
               end
           end
       end
mandelbrot_set! (generic function with 1 method)

julia> img = zeros(npoints, npoints)
3000×3000 Matrix{Float64}:
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0    0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0     0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0     0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0
                                                                                     
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0     0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0     0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0

julia> npoints = 3000
3000

julia> img = zeros(npoints, npoints)
3000×3000 Matrix{Float64}:
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0    0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0     0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0     0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0
                                                                                     
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0     0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0     0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0

julia> function normIterations(n, zn, b)
           return n - (log(log(abs(zn))) - log(log(b)))/log(2.0)
       end
normIterations (generic function with 1 method)

julia> mandelbrot_set!(img, -2.0,0.5,-1.25,1.25, npoints)


julia> dd = DimArray(img, (X,Y))
3000×3000 DimArray{Float64,2} with dimensions: X, Y
 4.01407  4.01439  4.0147   4.01502  4.01533    4.01533  4.01502  4.0147   4.01439  4.01407
 4.01458  4.01489  4.01521  4.01552  4.01584     4.01584  4.01552  4.01521  4.01489  4.01458
 4.01508  4.0154   4.01571  4.01603  4.01634     4.01634  4.01603  4.01571  4.0154   4.01508
                                                                                  
 4.84316  4.84443  4.8457   4.84697  4.84824     4.84824  4.84697  4.8457   4.84443  4.84316
 4.84233  4.84359  4.84486  4.84613  4.8474     4.8474   4.84613  4.84486  4.84359  4.84233

julia> ps = PS.Pyramid(dd)
3000×3000 Pyramid{Float64,2} with dimensions: X, Y
 4.01407  4.01439  4.0147   4.01502  4.01533    4.01533  4.01502  4.0147   4.01439  4.01407
 4.01458  4.01489  4.01521  4.01552  4.01584     4.01584  4.01552  4.01521  4.01489  4.01458
 4.01508  4.0154   4.01571  4.01603  4.01634     4.01634  4.01603  4.01571  4.0154   4.01508
                                                                                  
 4.84316  4.84443  4.8457   4.84697  4.84824     4.84824  4.84697  4.8457   4.84443  4.84316
 4.84233  4.84359  4.84486  4.84613  4.8474     4.8474   4.84613  4.84486  4.84359  4.84233

julia>     figps = Figure(title="Waldveränderung in Europa", size = (2000,1000));

julia>     axps = Axis(figps[1,1], title="Pyramid", yticklabelrotation=pi * 0.5, aspect=1)
Axis with 0 plots:


julia> plot!(axps, ps)
Heatmap{Tuple{Vector{Float64}, Vector{Float64}, Matrix{Float32}}}

julia> figps
Screencast.from.08.04.2024.14.14.25.webm
@asinghvi17
Copy link
Member

It almost looks like a mesh error of some kind. Do you see the same behaviour in GLMakie?

@asinghvi17 asinghvi17 added the WGLMakie This relates to WGLMakie.jl, the Web-based WebGL backend for Makie. label Apr 20, 2024
@felixcremer
Copy link
Contributor Author

GLMakie behaves nicely and I don't see such flickering.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug interaction WGLMakie This relates to WGLMakie.jl, the Web-based WebGL backend for Makie.
Projects
None yet
Development

No branches or pull requests

3 participants