Thoughts on transformations #4184
Replies: 12 comments
-
Thanks a lot, @jkrumbiegel! Just a couple of thoughts:
|
Beta Was this translation helpful? Give feedback.
-
Just chiming in here, rotation of the camera in a zoomed-in scene should rotate around the new center of the data, not the center of the data before the zoom. Matlab got that fixed only in the last (few?) version. |
Beta Was this translation helpful? Give feedback.
-
This is quite old now, but still something we should figure out. #1472 is requesting it, and in places where it's needed we currently have hacky and/or specialized code to handle it (e.g, setting projection matrices in DataInspector or the space options in text and scatter) so I'm thinking about working on this next. With respect to GL backends we already have the transformations for
and scene space is very simple because Some options for solving the former:
Adjusting shader compilation seems like the best approach to me. With respect to the second problem, I don't think we need to worry about it now. Ultimately we should always be able to project inputs to a unified space on the CPU if necessary. For the front end I really like Gadflys approach. Being able to write |
Beta Was this translation helpful? Give feedback.
-
At least parts of it are addressed in the new scene tutorial on master: |
Beta Was this translation helpful? Give feedback.
-
I don't generally like the approach of creating a new scene just for a different pixel or scene coordinates. Take DataInspector for example. There I want to create a tool tip when something is hovered. It should be attached to a position in data space, but I also want a background behind text to separate it from the rest of the visualization. The background needs to scale with text size, which is in pixel coordinates. How am I supposed to handle this? Draw the text (and a highlighter) in the correct scene and the background in another? I'd rather keep all the tool tip plots together. So I manually project and move everything to a pixel scene? Seems rather cumbersome... Another reason why I want this to work per plot is because I want to eventually try adding a postprocessing pipeline to scenes. I'm thinking of something like for scene in flattened_scenes
# clear buffer
for (stage, postprocessor) in enumerate(scene.render_pipeline)
render!(scene.plots, stage)
apply!(postprocessor)
end
# copy buffer to main buffer
end
# to screen which would mean clearing, drawing to and then copying from a temp buffer for each scene. I'm worried that might get expensive when lots of scenes are involved. (Though it might also be easy to combine scenes and if a scene only needs to render (i.e. no fxaa etc) it shouldn't be any more expensive than now.) On another note I also took a look at the primitive plots in MakieCore. There aren't a lot of attributes that can be transformed. There are linewidths (lines, linesegments and heatmap, though heatmap breaks with it in GLMakie), strokewidth (scatter, text), markersize (meshscatter, scatter) and textsize (text). I'm not sure if there is a use in having transformations for linewidths and strokewidths. I can see markersize for meshscatter being useful though and the rest is alreadyworking. So there isn't a lot missing |
Beta Was this translation helpful? Give feedback.
-
Yeah I was thinking we could just have multiple projections per scene... We already kind of have that with |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
But that's pretty much what we'd do by changing the space? You can't set a space and keep the same projection matrix... |
Beta Was this translation helpful? Give feedback.
-
What I mean is that right now you can do |
Beta Was this translation helpful? Give feedback.
-
Why not? I think that's exactly what we should do:
|
Beta Was this translation helpful? Give feedback.
-
Counterpoint: |
Beta Was this translation helpful? Give feedback.
-
Also these options would affect the view matrix (and the projectionview matrix) as well. Might be a bit misleading to group it with just the projection matrix |
Beta Was this translation helpful? Give feedback.
-
Most of this draws from https://matplotlib.org/users/transforms_tutorial.html, they had this stuff figured out pretty well already.
We probably need (at least?) 4 different levels of transformations in Makie:
Things that should be possible:
Depending on how you think about it, figure and axis could both just be called a container, so you could merge the two and make multiple nested versions possible. This would integrate neatly with arbitrary nested grids from the layout engine.
Beta Was this translation helpful? Give feedback.
All reactions