-
Notifications
You must be signed in to change notification settings - Fork 112
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added model_recalculate_bounds_exact() #578
Conversation
bound based on (transformed) vertices, instead of using per-mesh AABBs. Main reason for this is to have a much tighter bound, especially for interaction volumes.
Btw, |
Comparison on a model file where I noticed the (still) quite loose bounds. This is a GLB file that has a few different transforms (e.g. -90 rotation in X, -11 degree in Z) above several pieces of geometry. Current: center [-0, 0.26, 0], dimensions [12.43, 0.52, 11.94] Exact: center [-0, 0.26, -0], dimensions [9.28, 0.52, 8.5] Edit: fixed wrong pasted bbox values |
This is a pretty neat feature! Do you know what level of "slower" this might be? I imagine it's probably not so bad that it'd really need to be async, but I'm curious! I've also taken to using some of the DirectXMath functions directly for bounds stuff, I think its likely to have some good speed benefits in this loop! I'm not genuinely concerned about micro-optimization here, just wanted to shout out that there may be some low hanging fruit :) I'll take it either way if you're not keen on that right now! |
bounds computation. On a large unoptimized GLB file with 5.4M vertices and 5.4M indices exact bound computation goes from 99ms to 33ms. Tested with the C API on Linux.
Good suggestion on the DirectXMath functions. Just updated the patch and exact bounds computation time went from 99ms to 33ms. This is with the C API and a large unoptimized (85 visuals, 5.4M vertices and 5.4M indices) GLB file. |
Wooh, that's a hefty model! Yeah, okay, I can see why that might be a good candidate for async still, I'll keep that in mind for later :) Though I'm glad to know the DXM functions helped that much! |
I only now noticed that this model (one of a set I've been using for months) consists of unconnected triangles 馃槅 "Blame" it on modern hardware (GTX3090) and lean software like SK to make that hardly noticeable. |
This is a small update that includes a couple of PRs, some fixes and feedback, and improvements related to the maui template! - Added `Tex.SetMemory`, thanks Austin!. #574 - Added `Model.RecalculateBoundsExact`, thanks Paul! #578 - Added overload for `UI.ButtonBehavior` that takes a depth and activation depth. - Added image overloads for `UI.Radio`, and added `UI.RadioAt`. #571 - Added `UI.LastElementHandActive` and `UI.LastElementHandFocused`. - Deprecated `UI.LastElementHandUsed`. - Fix for custom GLX loader issue with Monado, thanks Moshi! #581 - Fixed a Maui hack related to UWP library references. #586
This computes a model bound based on (transformed) vertices, instead of using per-mesh AABBs. Main reason for this is to have a much tighter bound, especially for interaction volumes, at the cost of a longer time needed to compute bounds for models with many vertices.
Note that I haven't tested this from the C# side, but the C code does compile on Linux 馃槃