Use mesh scalar fields as optimization attributes in Studio (#2650) - #2664
Open
akenmorris wants to merge 11 commits into
Open
akenmorris wants to merge 11 commits into
akenmorris wants to merge 11 commits into
Conversation
Meshes often carry per-vertex fields -- thickness, curvature, parametric coordinates -- that the optimizer can already match through field_attributes, but there was no way to reach it from Studio, and grooming discarded the fields first: remesh and repair both rebuild the surface from bare points and cells. Adds a Mesh Scalars section to the Optimize panel, carries point data through those grooming steps, and reports a clear error when a chosen field is missing from a groomed mesh or a domain is not a mesh. Also fixes a crash in the field gradient, which assumed double precision and dereferenced a null array for the float fields meshes usually carry, and corrects the attribute Jacobian, which was left in the mesh's own frame while the update is assembled in world space.
A missing groomed mesh left the legacy point-cloud reconstruction as the only option, and its fixed sample spacing asked for a volume too large to allocate. The bad_alloc escaped MeshWorker's thread pool, which Qt turns into a terminate. The filter now refuses an impossible grid with a message naming the spacing and the bounding box, and mesh generation catches its own exceptions so no failure there can take the application down.
The two terms are combined without normalization, so one can be scaled out of the calculation with no sign of it beyond a poor model. Logs the per-particle magnitude of each, the attribute share of the correspondence update, and the sampling scale factor.
The function is cloned for every shape on every iteration and each clone counted from zero, so each one logged on its first call: ten lines an iteration, enough to stall Studio's log. Share the count between clones.
Ten near-identical ellipsoids carrying a field whose patch moves between subjects, with a tutorial page. Using the field puts the same particle on the patch in every subject.
With a feature map selected and PCA in shape-only mode there are no computed scalars, so every animation frame printed a points/scalars mismatch warning.
The first splits of an optimization have one or two particles, which Studio tried to reconstruct for display and reported as a failure.
A shape-only PCA mode has no values for the feature map, so particle indices were pushed through the feature's color scale: one blue, the rest red.
Repair copies fields point by point, so an array without a value for every point was read past its end: garbage on macOS, an access violation on Windows.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #2650
Meshes often carry per-vertex fields (thickness, curvature, parametric coordinates) that the optimizer can already match through
field_attributes, but Studio had no way to select them and grooming discarded them.Examples/Studio/MeshScalars, ten near-identical ellipsoids carrying a field whose patch moves between subjects, with a tutorial page (docs/studio/studio-mesh-scalars.md). With the field in use, the same particle sits on the patch in every subject.Tests added in MeshTests, GroomTests and OptimizeTests, including one that checks the attribute lines particles up on the field; docs updated for the Groom and Optimize panels and the optimize workflow.