-
-
Notifications
You must be signed in to change notification settings - Fork 292
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
Add clipping planes #3958
base: master
Are you sure you want to change the base?
Add clipping planes #3958
Conversation
Compile Times benchmarkNote, that these numbers may fluctuate on the CI servers, so take them with a grain of salt. All benchmark results are based on the mean time and negative percent mean faster than the base branch. Note, that GLMakie + WGLMakie run on an emulated GPU, so the runtime benchmark is much slower. Results are from running: using_time = @ctime using Backend
# Compile time
create_time = @ctime fig = scatter(1:4; color=1:4, colormap=:turbo, markersize=20, visible=true)
display_time = @ctime Makie.colorbuffer(display(fig))
# Runtime
create_time = @benchmark fig = scatter(1:4; color=1:4, colormap=:turbo, markersize=20, visible=true)
display_time = @benchmark Makie.colorbuffer(fig)
|
A CairoMakie implementation would have multiple approaches:
|
I think of these changes as mostly for 3D, so I'm looking to keep CairoMakie rather simple. Lines probably need the same manual clipping code across CairoMakie, GLMakie and WGLMakie so I'll implement that in CairoMakie too. Maybe voxels too. But everything else will probably just be a form of "if vertex is clipped don't draw". E.g. all the mesh-like plots just drop a face when one vertex is clipped atm. |
I'm wondering if I should rename |
sounds good, otherwise it's a bit like you want to clip planes |
d1ca4bf fixes an issue where lines just disappear in CairoMakie when one of their coordinates is far enough outside the screen limits. From Discord: data = 1e7*[0, 0.5, 10];
fig = Figure();
ax = Axis(fig[1,1]);
ylims!(ax, 0, 1000);
lines!(ax, 0.0:0.5:1.0, 1e3*[0, 0.5, 10]);
lines!(ax, 0.0:0.5:1.0, data);
fig
The fix I'm doing here is just adding clip planes for the scene boundary (i.e. -1..1 in clip space). This results in a point at the scene edge being added and points outside being discard. Thus the orange line draws: Adding that caused "Lines form outside" to fail in CairoMakie due to different colors. The reason for that was that color interpolation did not consider clipping. So even if, for example, the second point was moved due to clipping, it would still be assigned the same color, thus squishing the interpolation on a shorter segment.
"Lines from outside" should be expected to fail as the refimg doesn't adjust color interpolation to clipping. |
Description
Redo/Continuation of #2783.
Adds a
clip_planes
attribute to plots, allowing for up to 8 clipping planes to be defined (hard limit set in OpenGL). This will allow forAxis3
to clip a world space rectangle, which is the main blocker for zooming (and camera translation?) in Axis3.Example Rect-based clip:
TODO:
space
(ignore anything but :data?)Related #1655, #1667
Closes #3908
Type of change
Checklist