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

better near/far for offline JS camera #4430

Merged
merged 2 commits into from
Oct 1, 2024
Merged

Conversation

SimonDanisch
Copy link
Member

No description provided.

@MakieBot
Copy link
Collaborator

MakieBot commented Oct 1, 2024

Compile Times benchmark

Note, 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)
using create display create display
GLMakie 4.61s (4.57, 4.65) 0.03+- 112.41ms (107.62, 118.25) 3.93+- 495.63ms (486.57, 506.34) 8.14+- 9.74ms (9.24, 10.04) 0.34+- 26.55ms (26.40, 26.65) 0.08+-
master 4.61s (4.56, 4.68) 0.04+- 114.05ms (109.63, 121.88) 4.18+- 494.90ms (478.72, 508.01) 10.54+- 9.71ms (9.02, 10.11) 0.37+- 26.59ms (26.37, 26.69) 0.10+-
evaluation 1.00x invariant, 0.0s (0.09d, 0.87p, 0.03std) 1.01x invariant, -1.64ms (-0.40d, 0.46p, 4.06std) 1.00x invariant, 0.73ms (0.08d, 0.89p, 9.34std) 1.00x invariant, 0.03ms (0.09d, 0.87p, 0.36std) 1.00x invariant, -0.04ms (-0.46d, 0.41p, 0.09std)
CairoMakie 4.22s (4.15, 4.29) 0.04+- 107.38ms (106.14, 108.39) 0.80+- 171.37ms (167.48, 186.63) 7.09+- 9.72ms (9.66, 9.78) 0.05+- 1.15ms (1.13, 1.18) 0.02+-
master 4.18s (4.07, 4.28) 0.06+- 107.77ms (104.60, 113.98) 3.40+- 168.39ms (164.48, 174.49) 3.73+- 9.70ms (9.62, 9.79) 0.06+- 1.14ms (1.13, 1.18) 0.02+-
evaluation 0.99x invariant, 0.04s (0.68d, 0.23p, 0.05std) 1.00x invariant, -0.4ms (-0.16d, 0.77p, 2.10std) 0.98x invariant, 2.98ms (0.53d, 0.35p, 5.41std) 1.00x invariant, 0.03ms (0.48d, 0.39p, 0.05std) 1.00x invariant, 0.0ms (0.28d, 0.61p, 0.02std)
WGLMakie 4.83s (4.71, 4.90) 0.06+- 113.06ms (108.24, 121.08) 4.06+- 9.76s (9.65, 9.85) 0.08+- 12.23ms (11.95, 12.69) 0.23+- 117.30ms (114.44, 120.18) 2.14+-
master 4.80s (4.73, 4.86) 0.04+- 113.38ms (110.07, 117.89) 2.90+- 9.76s (9.64, 10.06) 0.15+- 12.44ms (12.01, 13.05) 0.33+- 118.24ms (114.83, 121.71) 2.18+-
evaluation 0.99x invariant, 0.03s (0.52d, 0.35p, 0.05std) 1.00x invariant, -0.31ms (-0.09d, 0.87p, 3.48std) 1.00x invariant, 0.0s (0.02d, 0.98p, 0.12std) 1.02x invariant, -0.2ms (-0.72d, 0.20p, 0.28std) 1.01x invariant, -0.94ms (-0.44d, 0.43p, 2.16std)

@ffreyer
Copy link
Collaborator

ffreyer commented Oct 1, 2024

Makie currently defaults to

elseif cam.settings.clipping_mode[] === :adaptive
view_dist = norm(eyeposition - lookat)
near = view_dist * near
far = max(radius(bounding_sphere) / tand(0.5 * cam.fov[]), view_dist) * far

with the input near far being
elseif cam.settings.clipping_mode[] === :adaptive
cam.near[] = 0.1
cam.far[] = 2.0

so the near value matches but the far value is still different. I don't think the far value matters that much though, since the camera/view space z (x) vs clip space z (y) scaling looks like this:
Screenshot 2024-10-01 145750
I.e. the clip space z values are very sensitive to camera/view space z values close to near, but not far. Changing far should have a relatively small effect.

@SimonDanisch SimonDanisch merged commit 94b7273 into master Oct 1, 2024
18 checks passed
@SimonDanisch SimonDanisch deleted the sd/fix-depth-shift branch October 1, 2024 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Merged
Development

Successfully merging this pull request may close these issues.

3 participants