Convert glTF / GLB models into Virt-A-Mate CustomUnityAsset (.assetbundle) packages — fully offline, without Unity.
glb2cua is the conversion engine behind CUA Asset Studio. It clones donor objects out of a prebuilt Unity "mold" asset bundle and bakes a fresh prefab straight from the glb's material → texture → channel graph, then writes a clean minimal bundle VAM can load as a CustomUnityAsset atom. Part of the Shadow Venom CRAFT tool line.
- Static path — no skin + no animation → flattened world matrices,
MeshFilter+MeshRenderer. - Animated path — skinned / rigid / hybrid → node tree preserved, per-mesh multi-skin, one
DenseClipdrives all TRS nodes.
It is a single self-contained script (glb2cua_mold.py) plus the Mold.assetbundle it bakes into.
Want a GUI with live 3D preview, a transform gizmo, and per-material editing? Use CUA Asset Studio, which drives this engine.
git clone https://github.com/R18SV/glb2cua.git
cd glb2cua
pip install -r requirements.txtMold.assetbundle ships in this repo; the script loads it from next to itself by default (override with the MOLD env var).
# single model
python glb2cua_mold.py <model.glb> [name] [out.assetbundle]
# batch every *.glb in a folder -> <outdir>/<name>.assetbundle + conversion_report.json
python glb2cua_mold.py <folder> [outdir]
# pack many models into ONE bundle with N switchable prefabs
python glb2cua_mold.py --pack <out.assetbundle> <glb|folder> [<glb|folder> ...]
# pack one multi-animation glb -> ONE bundle, one switchable prefab per clip
python glb2cua_mold.py --anims <out.assetbundle> <model.glb>In VAM, load the resulting .assetbundle on a CustomUnityAsset atom. For --pack / --anims bundles, switch prefabs via the atom's Asset-name dropdown (or a trigger).
All tuning is via env vars, so the engine stays a clean stdin-free CLI (this is exactly how CUA Asset Studio drives it):
| Var | Default | Meaning |
|---|---|---|
MOLD |
./Mold.assetbundle |
Path to the mold bundle baked into. |
TARGET_HEIGHT |
1.8 |
Target height in metres (when NORMALIZE=1). |
NORMALIZE |
1 |
0 keeps the glb's real size (props / rooms). Static path only. |
ORIENT_YAW |
0 |
Root yaw in degrees about Y, baked into vertices. Static path only. |
POS_X / POS_Y / POS_Z |
0 |
Root position offset in metres relative to origin. |
FORCE_OPAQUE |
0 |
1 forces all materials opaque (fixes glbs that spuriously mark solid surfaces BLEND). Default honors source alphaMode. |
TWO_SIDED |
off |
off / alpha / all — opt-in double-siding. |
VERTEX_COLOR |
0 |
1 uses the mold's unlit vertex-colour shader and writes COLOR_0 (for texture-less, vertex-coloured models). |
COLLIDER |
none |
none / box (AABB) / convex (per-mesh hull) / mesh (exact, physics-heavy). |
ANIM_INDEX |
0 |
Which glb clip to bake on the single path (all clips listed in the report). |
PINGPONG |
0 |
1 bakes forward+reverse so the loop's end frame equals its start (no snap-back). |
TEX_AUX_MAX / TEX_SLIM |
0 / – |
Downscale texture slots at bake time. TEX_SLIM is a set of normal / spec / albedo. |
SMOOTHNESS_MAX / METALLIC_BOOST |
0.7 / 1.0 |
Global smoothness cap / metallic multiplier. |
OVERRIDES |
– | Path to a JSON file of per-material overrides (see below). |
GC |
1 |
0 skips garbage-collecting mold residue (debug). |
{ "materials": {
"<material name | index>": {
"mode": "opaque|cutout|fade", "metallic": 0.0, "smoothness": 0.5,
"color": "#ffffff", "emission": "#000000", "emissionIntensity": 1.0,
"cutoff": 0.5, "normalScale": 1.0, "twoSided": false
}
}}Values are layered on top of the glb-read material values; mode wins over FORCE_OPAQUE.
A frozen single-folder build lets end users run the engine without a Python install. glb2cua.spec is included:
pip install pyinstaller
pyinstaller --noconfirm glb2cua.spec
# -> dist/glb2cua/glb2cua.exeThe spec collect_alls UnityPy and the texture codecs (etcpak / texture2ddecoder / astc_encoder) plus fmod_toolkit + pyfmodex (UnityPy loads these transitively even for mesh/texture-only work).
CUA Asset Studio shells out to this engine, passing the options above as env vars and the glb / output as arguments. The GUI's live three.js preview mirrors the same placement maths (centre on floor, normalize, yaw, position) so what you see is what gets baked.
MIT © 2026 Shadow Venom (R18SV)
Virt-A-Mate is a trademark of its respective owner. This project is an independent community tool and is not affiliated with or endorsed by Virt-A-Mate.