Replies: 7 comments 16 replies
-
That should be fine, especially if you can get away with a meshscatter. In that case you'd be restricted to stretching of a constant mesh along x/y/z direction, but you end up with just one render object. Something along the lines of: fig = Figure(backgroundcolor=:black)
ax = LScene(fig[1, 1], show_axis = false)
pos = 10 .* rand(Point3f, 1000)
colors = rand(RGBf, 1000)
scales = 0.2 .* [Vec3f(0.5) .+ v for v in rand(Vec3f, 1000)]
meshscatter!(ax, pos, color = colors, markersize = scales)
fig
Makie takes a while going from not-imported to displayed-plot. After that making a new plot is fast and runtime changes are also fast (as long as you don't trigger compilation of stuff you didn't use before). For a long running application like this I don't see TTFP as much of an issue. This also something that has been getting better with new Makie and Julia versions. The long load times you're seeing are probably a combination of package compile time (once per version), import time and jit compilation.
Only CairoMakie is static. GLMakie and WGLMakie both have a renderloop and interactivity.
If you don't want an axis yes. See above
Makie is designed around Observables which propagate updates. For example you could react to changes of |
Beta Was this translation helpful? Give feedback.
-
Thanks @ffreyer I start to understand things much better. The TTFP for simple things is definitely fine but for OpticSim I really need to wait up to 5min until I can see something, which is what worried me. But I also realised that it's pinned to older Makie versions etc., so that's probably fine 😉
Yes I saw that already, I am currently experimenting with it!
This is probably more problematic in my case. Let me try to explain: in case of the original application, I simply have a
I am now figuring out how |
Beta Was this translation helpful? Give feedback.
-
I'd start like this: using GLMakie, GLFW
scene = Scene(backgroundcolor=:black)
cam3d!(scene) # leave out if you implement your own camera
pos = 10 .* rand(Point3f, 1000)
colors = rand(RGBf, 1000)
scales = 0.2 .* [Vec3f(0.5) .+ v for v in rand(Vec3f, 1000)]
meshplot = meshscatter!(scene, pos, color = colors, markersize = scales)
# center camera to boundingbox of plots
center!(scene)
screen = display(GLMakie.Screen(start_renderloop=false), scene)
# Best look up how renderloop is implemented here, since it's not very well documented
# https://github.com/MakieOrg/Makie.jl/blob/master/GLMakie/src/screen.jl#L656
while isopen(screen)
# do your updates, put your camera(scene) updates here as well if implementing your own camera
meshplot.colors = rand(RGBf, 1000)
meshplot.markersize = 0.2 .* [Vec3f(0.5) .+ v for v in rand(Vec3f, 1000)]
meshplot[1] = 10 .* rand(Point3f, 1000)
GLMakie.pollevents(screen)
GLMakie.render_frame(screen)
GLFW.SwapBuffers(GLMakie.to_native(screen))
end
GLMakie.destroy!(screen) Not using Figure + LScene, should give you quite a bit faster TTFP and from what I see you really don't need it :) You can also look at https://github.com/MakieOrg/Makie.jl/blob/master/src/camera/camera3d.jl, to see how to implement the camera... In essence, it boils down to updating the matrices in There shouldn't be anything you can't do, Makie gets quite low level if you want to (although the low level apis aren't as well documented...).. |
Beta Was this translation helpful? Give feedback.
-
Many thanks Simon and Frederic, I think the fog begins to lift 😉 I'll now explore Simon's sketch with the |
Beta Was this translation helpful? Give feedback.
-
Let us know how it goes, looks like a fun project :) |
Beta Was this translation helpful? Give feedback.
-
So after a longer break I revived this tiny project and so far the performance seems fine without using custom shaders (I am happy with the ball-shaders from geometry toolbox 😉 ) I still have a few bigger obstacles but let's start with the most annoying one: I can't figure out how to use the I am using this code to create and place the camera (I read through https://docs.makie.org/stable/documentation/cameras/), but as seen in the screenshot, it points slightly above the black sphere (0, 0, 0) and rotates somewhere around the z-axis near the black sphere, between the red and black sphere. It's obviously doing some automatic guessing where I want to look at based on the objects in the scene. cam = cam3d!(scene, rotation_centre = :lookat)
update_cam!(scene, cameracontrols(scene), Vec3f(1000), det_center)
# also tried with directly passing it:
# update_cam!(scene, cam, Vec3f(1000), det_center) If I add more objects, it even sends the camera to a very far distance. What am I doing wrong? |
Beta Was this translation helpful? Give feedback.
-
Sorry for the spam, but very happy with the results so far, thanks for all the input! 🙂 That's a muon neutrino CC event in one of the KM3NeT neutrino detectors (it's interactive and nicely animated): |
Beta Was this translation helpful? Give feedback.
-
Good day! I am very new to Makie and worked myself through the docs and some examples but I am still not sure if it's the right tool, so allow me to ask some basic questions, I am sure you can toss me into the right direction.
A little bit of motivation: I am about to rewrite a very old project of mine in Julia. It's a 3D event display of neutrino interactions in the KM3NeT detectors written in Python using (Free)GLUT and PyOpenGL (a wild mix of legacy and modern pipelines with shaders). Back then, I only needed a camera and some input detection for keyboard and mouse for zooming, panning, mode selection etc. (the menu was just a text overlay showing the supported key presses), so I went with the bare frameworks and wrote the OpenGL code by hand. It's fairly simple but of course Python has its limits.
This is how it looks like:
Now I revived the project and since we already have a Julia framework, I'd like to do the 3D display in Julia as well.
I am wondering if
Makie.jl
is the right framework for such an application? I need to keep track of potentially thousands of objects which change colour, shape and position based on time and I am not sure if this is easily doable in Makie. The good thing is: I can more or less get away with just lines and spheres (maybe some transparent sphere shells and cones for wavefront propagation). I also searched for similar applications and found Opticsim.jl (https://github.com/microsoft/OpticSim.jl/blob/main/src/Vis/Visualization.jl). It looked like it's what I am searching for, saw some comments that 2D stuff is done in Luxor because it's faster, but in general I thought Makie is a good candidate but then I was really scared about the TTFP times. The examples take several(!) minutes to start on my macOS M1 and not all of them start at all (that's another issue).So Maybe it's better to start from scratch and implement my own camera and input processing because Makie is more suited for static display and arrangements? However, taking benefit of the already existing event handling and scene creation of Makie would definitely make my life easier ;)
Sorry for the vague questions and for not spending much more time with trying things by myself but I sometimes I prefer asking experts before I waste time ;) Let me boil everything down to a few concrete ones:
LScene
is the right place to start? (https://docs.makie.org/v0.18.1/examples/blocks/lscene/)LScene
(given thatLScene
is the right design pattern)? In the docs I only found movie recording capabilities, which work nicely but I'd like to interact with them (play/pause, slow-down, pan/zoom/rotate, ...)Of course I'd like to contribute some basic examples for the Makie docs once I figure out the right way.
Beta Was this translation helpful? Give feedback.
All reactions