Mesh Audio Editor
Real-time mesh viewer and editor supporting conversion of meshes into interactive rigid body audio models.
Manual, Renders

Rendering and architecture
Features and how to use them are in the manual.
The notes below cover notable implementation details.
History and state
- Every edit is recorded as a node in a branching history tree, and any node of the tree can be restored directly, at a cost proportional to the data that differs from the current state
- Each version of the document is a hash trie over pages of component data and GPU buffer data. A new version shares every unchanged branch with the version before it, so a step stores the pages it changed, and identical pages are stored once across the tree
- The tree, each node’s actions, and the page contents are appended to log files as edits are committed, so a project reopens with its full history
- UI and event code changes the document through actions of at most 64 bytes that carry the user’s intent, and each history node stores the actions that produced it
- Replaying the recorded actions from the empty scene reproduces the same document byte for byte, and the same rasterized viewport and UI pixels. Ray-traced pixels are the exception, since their temporal accumulation restarts on a restore
- A
VALIDATE_ACTIONS=1 build verifies this after every committed action. It rebuilds the current step twice in separate sessions, once by replaying its actions and once by loading its stored pages, and compares each result with the live session: document and workspace bytes, the viewport image, and the image of the whole window. Any difference stops the app and writes an .actions archive that reproduces the failure. MeshEditorProjectTest applies the same check to every history scenario
- Document state is stored in paged sparse tables indexed by compile-time slots
- Each component type is Persistent, Workspace, or Derived. History records Persistent and Workspace components, and Derived components are rebuilt from them
Mesh editing and node graphs
- Each mesh is the output of a node graph, and viewport operators edit the mesh by adding or changing nodes
- Topology operators such as extrude, bevel, subdivide, knife, boolean, convex hull, and simplify run as compute kernels over half-edge connectivity stored on the GPU, and the cost of an edit is proportional to the elements it changes
- A graph of MaterialX nodes compiles to one Metal function, which pipelines call through a function table, so the same graph evaluates on mesh elements, in texture bakes, in raster shading, and at ray hits
- MaterialX’s GLSL node implementations are translated to Metal when the library loads, and functions that take screen-space derivatives are rewritten to take neighboring values, so they also run in compute passes and at ray hits
Rendering
- Each mesh is stored as meshlets at several levels of simplification, and every frame, compute passes set the level of each cluster from its screen-space error, cull hidden clusters, and write the arguments of the indirect draws, so one mesh draws coarse in the distance and at full detail up close
- Opaque meshlets rasterize IDs into a visibility buffer, then attributes and materials are decoded once per pixel
- Transparent surfaces composite in one pass that stores each pixel’s nearest four surfaces in depth order and a weighted sum of the rest
- A mesh edit rebuilds the finest clusters that contain its changed triangles and the coarser levels above them
- A compute pass applies skinning and morph targets, writing posed positions and meshlet bounds
- Rendering uses Metal 4 through metal-cpp, and the platform layer is AppKit, Core Audio, Accelerate, and Apple SIMD (the last Vulkan commit is dae664bd)
- One Metal 4 queue runs every command, residency change, and sparse mapping update
- Each long-lived buffer is a sparse buffer whose CPU and GPU address ranges map the same 64 KB physical pages, so it grows in place and the CPU and GPU read and write the same memory
- Undo history stores the pages changed by each CPU or GPU write, and a GPU pass reads an earlier version through a read-only clone that maps those pages at their original offsets
- Every buffer, texture, and sampler is bound through one bindless argument buffer, and the material preview binds the document’s set to draw its materials
- Pipelines are specialized by function constants. The fixed pipelines and the shading variant without features are precompiled into a pipeline archive at build time. Any other shading variant compiles in the background on first use while the viewport keeps drawing, and loads from its own archive file after that
- GPU structs and function-constant indices are declared once in
src/gpu/ headers that both C++ and MSL include
Overlays and selection
- Mesh shaders emit edit-mode edges, points, normals, and bones from the visible meshlets, and wireframes rasterize in a compute pass
- Box selection and picking run on the GPU, and each mesh’s selection bits are stored with its other GPU data
- A box selection updates on every frame of the drag (Blender selects on mouse up)
Physics and audio
- RigidBodyPhysics is an AVBD rigid body solver that runs on the GPU, and the simulation is cached per timeline frame
- FastFEM tetrahedralizes a surface mesh and solves for its vibration modes
- A modal resonator bank synthesizes the sound on the audio thread, driven by physics contacts through a Hertz contact model
Ray tracing
- Visible surfaces are rasterized, and Metal hardware ray tracing adds shadows, reflections, glass, and optional diffuse lighting, followed by temporal accumulation and denoising
- Acceleration structures are built over the same vertex position buffers the rasterizer uses
- The film filter, light culling, area lights, and screen-space diffuse lighting follow Blender EEVEE’s implementations
The comparison with Blender EEVEE has frame timings during motion, glass refinement after the camera stops, and matching images.
Physical audio modeling
MeshEditor generates a physical audio model from a mesh using linear modal analysis and synthesis.
It began as a Georgia Tech PHYS-6260 Computational Physics project, documented in the final report and the poster below.

The report and poster describe an earlier synthesis path that generated Faust code, last used in commit 31a817dd.
The current modal resonator bank plays many objects at once and responds to physics collisions.
Impact audio experiments
These examples compare synthesized modal impacts with recorded impacts from RealImpact, using its scanned meshes.
Each synthesized impact injects a short wideband pulse at the selected vertex.
The blog post has embedded audio players.
The cylinders mark the recorded microphone positions.
Every recording here uses one microphone centered near the impacted object.
The modal samples are estimated surface vibrations, as a contact microphone would record them, with no acoustic radiation model.
glTF
MeshEditor views, edits, and exports glTF 2.0.
glTF nodes become meshes, armatures, cameras, lights, and empty objects, and parenting keeps the node hierarchy.
Khronos-ratified extensions that affect scene appearance are imported, rendered, and editable.
Loading and saving a file preserves its glTF data, except for the cases listed in tests/RoundtripTest.cpp.
The PBR BRDF and lighting equations come from the reference glTF-Sample-Renderer shaders.
Metal function constants specialize the PBR shader for the current materials, lights, and image-based lighting.
A change to the feature mask rebuilds the affected pipeline states from cached MSL libraries.
Supported extensions
| Extension |
Status |
Notes |
KHR_mesh_quantization |
✅ |
Handled by the fastgltf parser |
EXT_mesh_gpu_instancing |
✅ |
Imported as instances |
KHR_lights_punctual |
✅ |
Imported as lights |
KHR_texture_transform |
✅ |
|
KHR_texture_basisu |
✅ |
Transcodes KTX2 via basis_universal to BC7, ETC2, or RGBA32, chosen by device support |
EXT_texture_webp |
✅ |
Decodes via libwebp. Export re-encodes edited textures as lossless WebP |
KHR_materials_emissive_strength |
✅ |
|
KHR_materials_unlit |
✅ |
|
KHR_materials_specular |
✅ |
|
KHR_materials_sheen |
✅ |
|
KHR_materials_ior |
✅ |
|
KHR_materials_dispersion |
✅ |
|
KHR_materials_transmission |
✅ |
With Real transmission on in the viewport shading options, samples a pre-rendered scene texture. With it off, samples the IBL |
KHR_materials_diffuse_transmission |
✅ |
|
KHR_materials_volume |
✅ |
|
KHR_materials_clearcoat |
✅ |
|
KHR_materials_anisotropy |
✅ |
|
KHR_materials_iridescence |
✅ |
|
KHR_materials_variants |
✅ |
|
KHR_physics_rigid_bodies |
✅ |
Not yet ratified |
KHR_implicit_shapes |
✅ |
Not yet ratified |
KHR_node_visibility |
✅ |
Loads and roundtrips conformantly, with the export limitation below |
KHR_animation_pointer |
✅ |
Every mutable Object Model property of the supported extensions |
EXT_lights_image_based |
✅ |
Imported as the scene IBL |
EXT_meshopt_compression |
✅ |
Decodes compressed bufferViews via meshoptimizer. Export writes uncompressed geometry |
glTF cannot represent a hidden parent with visible descendants, so export drops that state.
Build & run
Requires an Apple Silicon Mac with macOS 27 or later and the Xcode command-line tools.
$ brew install cmake ninja llvm
$ git clone --recurse-submodules [email protected]:khiner/MeshEditor.git
$ cd MeshEditor
$ script/Clean # optionally clean first
$ script/Build [--release]
$ cd build && ./MeshEditor [file|--empty] [options]
The manual covers the rest:
See production libraries for source ownership, dependencies and optimization settings.
Stack
- Metal via metal-cpp, AppKit, and ImGui: graphics and immediate-mode UI
- Apple SIMD: vector and matrix math
- macOS Core Audio: HAL output and native audio-file I/O
- FastFEM: tetrahedralization, finite-element assembly, and modal eigensolves
- fastgltf: glTF 2.0 scene loading
- MaterialX: the standard node definition libraries, loaded by MeshEditor’s own reader (the MaterialX shader generator is a test-only reference)
- meshoptimizer: cluster LOD builds and
EXT_meshopt_compression decoding
- RigidBodyPhysics: rigid body physics
- basis_universal: KTX2 texture transcoding (
KHR_texture_basisu)
- libwebp: WebP texture decoding, and lossless encoding of snapshots and textures (
EXT_texture_webp)
- tinyobjloader and tinyply:
.obj and .ply mesh loading
- lunasvg: SVG icon rasterization
- Accelerate: vDSP Fourier transforms for the spectrum plots, and FastFEM’s BLAS, LAPACK, and sparse kernels
- ImPlot: plotting
- boost-ext/ut: testing
Development
Sample data
glTF-Sample-Assets and glTF_Physics are Git submodules under external/.
They populate File → glTF Samples and File → glTF_Physics Samples, which are empty until the submodules are initialized:
$ git submodule update --init external/glTF-Sample-Assets external/glTF_Physics
The external/RealImpact submodule has each object’s scanned mesh, texture, and measurement metadata:
$ git submodule update --init external/RealImpact
See RealImpact import in the manual for loading an object.
The recordings are 2.8 GB per object and are not stored in Git.
Download them with:
$ external/RealImpact/dataset/download.sh # every object, 128 GB
$ external/RealImpact/dataset/download.sh 9_BowlCeramic 22_Cup # just these two
An object without recordings still loads its mesh, microphone positions, and impact vertices, but has no sample-based audio model.
Tests
Builds and validation in the manual covers the build options and a basic test run.
cmake --build build --target tests/all builds every test target:
| Target |
Covers |
MeshEditorTests |
glTF roundtrip over every sample, every action alternative through the action log, edit selection primaries |
MeshEditorProjectTest |
Every history scenario replays, restores cold and reopens to the same document and image: geometry graphs, viewport gestures, each mesh operator against its kernel and Blender references, subgraph instances and glTF samples |
MeshEditorGeometryTest |
The headless mesh kernels over every topology operator: mask and list selections agree, unselected geometry and named attributes survive, booleans yield the expected solids, plus element arenas, Metal buffers and cluster LOD builds |
MeshEditorStoreTest |
Sparse native tables, entity generations, mutation capture and dirty sets against a model, version and history models, persistence failures, .project archives |
MeshEditorAudioTest |
Hertz and punch contact laws over a grid, inertia decomposition, modal superposition, thread and rate independence, wav round trips, FastFEM surface solves |
MeshEditorPhysicsTest |
Rigid body mass properties against analytic tensors over random colliders, shape scaling, failure and replacement |
MeshEditorMaterialXTest |
MaterialX node declarations against the reference library, and every native node implementation compiled as Metal and evaluated on its domains |
MeshEditorMslCompileTest |
Every shader compiles, or only the shader files given as arguments |
MeshEditorTransparencyTest |
The tile compositor against depth-sorted source-over |
MeshEditorPipelineCacheTest |
Writing and reading a Metal pipeline archive, run through script/ValidatePipelineCache |
MeshEditorProjectBench |
Time and bytes the history costs per edit |
MeshEditorEditBench |
End-to-end time of a mesh edit |
The first seven take a test name pattern as an argument, and MeshEditorProjectTest also takes --no-render.
Run both ray-tracing viewport tests with build/tests/MeshEditorProjectTest 'ray tracing*'.
They render the studio, vase, area-lit glass, and animated skin headlessly.
An image mismatch writes the current frame and an amplified difference to build/ray-tracing-failures/.
The fixed-input test checks the linear HDR frames before tone mapping.
A SURFACE_AUDIO=1 build adds the surface-contact audio model (src/audio/surface/) with its tests, benchmarks, and scores under tests/surface/.
See src/audio/SurfaceContact.h for its entry points from the core modal code.
FastFEM has its own analytical, tetrahedralization, real-mesh, and performance corpora, documented in lib/FastFEM/README.md.
Render corpus
render/ holds the committed output of every corpus scene, in the same directory layout as the sources.
Binary artifacts are stored in git-lfs.
Fetch them after cloning:
$ git lfs install
$ git lfs pull
Regenerate the corpus with script/Render.
It requires the glTF submodules, and ffmpeg on PATH for videos.
The output is deterministic, so after a regeneration git status shows only the scenes whose rendering changed.
script/RenderFidelity --app-args "FLAGS" renders a candidate corpus with FLAGS and reports each scene’s pixel differences from the committed corpus.
See Render and audio comparisons in the manual for the corpus contents, overlay captures, and comparison tools.
Benchmarks
See Performance benchmarks in the manual.
The large generated datasets under res/benchmarks/ are ignored by Git, and the small Overlays/ scene is committed for the render corpus.
Update submodules
Submodules are in lib (libraries) and external.
Update a library submodule to its branch tip:
$ git submodule update --remote {path}/{submodule}
$ git add .
$ git commit -m "Update {submodule} ..."
评论