Repository navigation
feat(core,lang): auto-smooth defaults, concave/hollow loft & 3D sheet, and O(V) scene instancing - #137
Merged
Conversation
…, and O(V) scene instancing
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.
Summary
Addresses the three shared frontier-model friction points surfaced by multi-model Forma bakeoffs (flat shading by default, concave/cloth
loft()limits, and 10 MB / 500-piece ungrouped GLBs):1. Auto-Smooth Default, Propagation, Spec Visibility & Smooth Studio Rendering
PolyMesh::new()tosmooth_angle_deg = Some(35.0)andweighted_normals = true(DEFAULT_SMOOTH_ANGLE_DEG): keeps 45°/60°/90° hard edges razor-sharp while automatically shading domes, spheres, cylinders, bevels, lofts, and sheets smoothly (and welding GLB vertices cleanly). Opt out anytime with| flat().smooth_angle_degandweighted_normalscleanly through booleans (boolean.rs), Catmull-Clarksubsurf, and QEMdecimate(ops.rs).smooth(angle=35)andflat()directly in coreSPEC_PIPE.raster_tri_gouraud) driven bycompute_corner_normals()and smooth-aware feature edge creases inrender.rsso zero-GPU studio PNG previews match GLB shading.2. Concave
loft()Alignment + Watertight Thin-Shell Cloth Primitivesresample_closed_2dwith translation-invariant centered minimum-squared-distance cyclic alignment (align_ring_to_prev, withalign=falseopt-out), eliminating twisting/self-intersection on C-shaped, pleated, and concave profiles.loft(..., t=...)(thickness/wall) inmake_loft_extfor instant watertight open-ended hollow shells (genus 1, zero booleans).sheet(rows, t=0.02, closed=false)(make_sheet) taking a 2D grid of 3D(x,y,z)points (usable directly with nestedForma-Pipelist comprehensions) thickened symmetrically along smooth vertex normals into a watertight manifold patch (closed=false, genus 0) or seamless 3D draped mantle/poncho (closed=true, genus 1).3. Lean 3-Layer Scene Hierarchy, Automatic$O(V)$ GLB Deduplication & 64-Byte
int4Packaging Policyinstancing.rs, zero extra LLM tokens): DeterministicL = B * A^-1, verified per-vertex to< 1e-4 * diag, exact Y-up similarity transform) automatically deduplicates deep-transformed copies into 1 shared glTF mesh + per-node TRS.scene.rs,pipeline.rs,forma_pipe.gbnf): Add| group("pavilion/drum"),group("pavilion/drum", ["a", "b"]), andinst(proto, at=[...], rot=[...], scale=..., group="...", name="...")sharing a singleArc<PolyMesh>prototype (validated once under--strict, rendered in--scenePNG/SVG previews, transactional acrosscheckpoint/rollback/undo/del, and collapsed to a single summary line inScene::observe()).instancing.rs,export.rs): Add a 64-byte quantized12 -> 8 -> 4signedint4packaging policy (choose_scene_pack_strategy, ~0.3 µs CPU/WASM, bit-exact) routing deduplicated clusters acrossStandalone,DataInstance(default core glTF 2.0),GpuInstance(EXT_mesh_gpu_instancing), andGpuInstanceSpatialCells(2×2×2 spatial cells for frustum culling viaGlbSceneOptions::realtime()).Benchmarks & Tests
121,548 B→9,632 B(48 meshes → 1 shared mesh, 12.6× smaller), exactread_glb_bytesround-trip.1nestedpavilionroot,4meshes):105.5 KB,observe()stays<= 14lines.GlbSceneOptions::realtime()(int4policy →EXT_mesh_gpu_instancing):35.6 KB.forma-core/src/instancing.rs,forma-core/tests/regression_fixes.rs, andforma-lang/tests/lang_expressiveness.rs; verified workspace--releasetests andscripts/check_local_paths.py.