twin-optimize

Optimizes Godot digital-twin scenes with chunked MultiMesh instancing, occlusion culling, and measured benchmarks.

Updated Jul 8, 2026
One-click install
npx skills add https://github.com/arthur0n/xenodot-twin --skill twin-optimize-arthur0n
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: twin-optimize
Source: https://github.com/arthur0n/xenodot-twin/tree/main/plugin/skills/twin-optimize
Command: npx skills add https://github.com/arthur0n/xenodot-twin --skill twin-optimize-arthur0n

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Large digital-twin scenes in Godot stutter or miss frame budgets, and naive fixes like fixed-grid chunking or blanket occlusion culling can actually regress performance. This Skill provides measured recipes and a headless optimizer tool that scale a twin viewer to high instance counts without lying about fps. ## Core Features & Use Cases - Headless scene optimization: tools/optimize_scene.gd groups MeshInstance3Ds into auto-chunked MultiMeshInstance3D fields, preserves GlobalId joins via twin_globalids metadata, and emits a JSON report. - Scoped culling recipes: Measured guidance on when --occluders and --vis-ranges win (many-unique-mesh scenes at street level) versus when they are net-negative (single buildings) or no-ops (instanced/aerial scenes). - Honest benchmarking: tools/bench_scene.gd and tools/bench_sweep.sh implement a frames-drawn-delta methodology with vsync off, warmup, interleaved repeats, and determinism assertions that survive macOS display caps. - Use Case: A 28,600-mesh city scene renders at 27 fps aerial; run the optimizer with auto chunking to reach the 120 fps cap, then bench both street and aerial vantages to confirm the win before reporting it. ## Quick Start Run the headless optimizer on my imported twin model with auto chunking and then benchmark the before and after scenes at both street and aerial vantages.

Frequently Asked Questions about twin-optimize

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I optimize a Godot scene with thousands of mesh instances?

Run tools/optimize_scene.gd headless with --in, --out, and --report flags. It groups MeshInstance3Ds by mesh and material, collapses groups above --min-instances into auto-chunked MultiMeshInstance3D fields, and preserves GlobalId joins via twin_globalids metadata.

How do I benchmark fps in Godot on macOS accurately?

Compute fps from Engine.get_frames_drawn() deltas over elapsed time, disable vsync, warm up 2 seconds, and measure 8 seconds per config. macOS caps presentation at the display refresh, so compare cpu_ms instead of fps when pinned at the cap.

When should I use chunked MultiMesh versus a single MultiMesh in Godot?

Chunk when the primary camera is a walkthrough view, since frustum culling can reject chunks and measured walkthrough fps rose 39% at 1M instances. A single or coarse MultiMesh suits overview dashboards, where chunking added draws and cost 12% fps.

Does Godot occlusion culling always improve performance?

No. Occlusion culling is a scoped win: it helped many-unique-mesh city scenes at street level but was net-negative on single buildings and a no-op on instanced or aerial scenes. It also requires use_occlusion_culling enabled in project settings.

Why did my MultiMesh buffer assignment silently fail in Godot?

You must set instance_count before assigning the buffer, and set use_colors before instance_count or the stride is wrong. Also, Node3D.global_transform returns identity during SceneTree._init, so wait one process_frame before reading transforms.

Can visibility range fading be used in a Godot web export?

No. The visibility fade renders only under the Forward+ renderer; the Compatibility renderer used by web builds treats it as disabled, so the hard pop returns. Web-bound twins cannot rely on the fade to justify aggressive cutoff distances.