Dashboard →

Using GLBoost assets in LVGL and other embedded runtimes

Microcontroller glTF viewers such as LVGL's lv_gltf (fastgltf + OpenGL ES 2.0) load plain glTF 2.0: no Draco, no meshopt, no KTX2, no quantization. GLBoost produces files that fit that profile and, optionally, a byte budget.

1. Pick the embedded preset

The embedded preset writes float32 geometry with no compression extensions, joins draw calls, prunes unused nodes, simplifies to 50 % of the triangles, and encodes textures as WebP at 512 px or less (JPEG/PNG are selectable with tex=). Request it from the dashboard (Variants → embedded) or the API:

curl -X POST https://glboost.com/api/v1/assets/<assetId>/variants \
  -H "Authorization: Bearer $KEY" -H "content-type: application/json" \
  -d '{"preset":"embedded"}'
# served at https://cdn.glboost.com/<assetId>.glb?p=embedded

2. Fit a byte budget

Budget mode searches for the largest variant that the target runtime can load under a byte limit: it halves texture sizes down to 256 px, then simplifies geometry, and stops at the first pass under budget (at most six passes). The result is a normal variant whose spec is reported back as resolvedSpec.

curl -X POST https://glboost.com/api/v1/assets/<assetId>/variants \
  -H "Authorization: Bearer $KEY" -H "content-type: application/json" \
  -d '{"budgetBytes":2000000,"target":"lvgl"}'
# → 201 { "variant": { "spec": "budget:2000000:lvgl", "status": "queued" }, "created": true }
# poll GET /api/v1/assets/<assetId>/variants until the row is ready; its spec becomes e.g.
#   anim=keep,geo=raw,maxtex=512,q=low,simplify=0.5,tex=webp

DamagedHelmet (3.8 MB) resolves on the first pass at about 620 KB for the LVGL target. Targets: lvgl, quick-look, unreal, godot, unity-gltfast, filament, playcanvas, model-viewer, babylon, threejs.

3. Export for flash or a filesystem

Two exports are available per ready variant (dashboard: Variants → Export, or POST /api/v1/assets/<assetId>/exports):

  • Unpacked glTF (.zip): model.gltf + model.bin + textures, for lv_gltf_load_model_from_file() from an SD card or LittleFS.
  • C array (.h): the GLB as static const uint8_t for lv_gltf_load_model_from_bytes(), compiled straight into the firmware.
curl -X POST https://glboost.com/api/v1/assets/<assetId>/exports \
  -H "Authorization: Bearer $KEY" -H "content-type: application/json" \
  -d '{"variantId":"<variantId>","format":"c-array"}'
# once ready, download with the variant's query string:
curl -o model.h "https://cdn.glboost.com/<assetId>.h?p=embedded"
curl -o model.zip "https://cdn.glboost.com/<assetId>.zip?p=embedded"
/* model.h as generated by GLBoost */
#include <stdint.h>
#define GLBOOST_<ASSETID>_LEN 620820u
static const uint8_t glboost_<assetid>[GLBOOST_<ASSETID>_LEN] = { 0x67, 0x6c, 0x54, 0x46, ... };

4. Image-based lighting on a microcontroller

Upload an equirect environment under Settings → Environments (HDR, JPEG, or PNG). GLBoost renders 64, 128, 256, 512, and 1024 px JPEG maps (plus Radiance HDR for HDR sources). For MCUs use 64 or 128 px: the 128 px JPEG of the built-in studio map is under 2 KB and the HDR twin about 33 KB.

curl -o env128.jpg "https://cdn.glboost.com/env/<envId>.jpg?size=128"
curl -o env128.hdr "https://cdn.glboost.com/env/<envId>.hdr?size=128"   # HDR sources only
# built-ins: https://cdn.glboost.com/_/env/studio.hdr and https://cdn.glboost.com/_/env/outdoor.hdr

5. Check compatibility before you ship

The Compatibility tab (and GET /api/v1/assets/<assetId>/compat) reports per runtime whether a variant loads as is (ok), needs a decoder (meshopt, Draco, KTX2), or is unsupported, naming the blocking extension or texture format. An embedded variant reports ok for every runtime in the matrix.

6. Minimal LVGL sketch

#include "lvgl.h"
#include "model.h"        /* GLBOOST_<ASSETID>_LEN + glboost_<assetid> */

static void show_model(lv_obj_t * parent)
{
    lv_obj_t * viewer = lv_gltf_create(parent);
    lv_obj_set_size(viewer, 320, 240);
    lv_gltf_load_model_from_bytes(viewer, glboost_<assetid>, GLBOOST_<ASSETID>_LEN);
    lv_gltf_set_env_map_from_file(viewer, "S:/env128.hdr");   /* or a JPEG on LDR builds */
    lv_gltf_set_yaw(viewer, 30);
    lv_gltf_set_pitch(viewer, -10);
    lv_gltf_set_distance(viewer, 2.5f);
}

Function names follow the LVGL glTF docs; check your LVGL version for the exact API. Back to the API reference.