Assets

Turian uses an import pipeline: the files you drop into a project's assets/ folder are sources. On import each source is assigned a stable GUID (stored in a sidecar <file>.meta) and cooked into a runtime artifact under .cache/assets/. The shipped game reads those artifacts from a packaged .oap and never touches the loose assets/ folder. References between assets (a material's textures, a MeshRenderer's mesh) are stored as GUIDs, so they survive renames and moves.


Importing models (glTF / GLB / OBJ)

Dropping a .gltf, .glb, or .obj into assets/ imports its geometry. For glTF/GLB, Turian also reads the file's materials and textures and generates engine assets from them — a single model is a source that produces many assets:

  • one .material per glTF material, mapping the glTF metallic-roughness model onto the built-in PBR shader (base color, metallic, roughness, emissive + strength, normal scale, occlusion, alpha mode/cutoff, double-sided → cull);
  • one texture asset per image it references.

These generated assets are recorded in the model's .meta and keep their GUIDs across reimports, so scene references stay valid. Unsupported material extensions are warned about, never fatal.

Geometry is cooked to a canonical binary mesh at import time, so the runtime loads it with one fast, format-agnostic path — OBJ/glTF/cgltf parsing happens only in the editor, never in the shipped game.

Editing generated sub-assets

Select an imported model in the asset browser; the inspector lists its generated materials/textures under Generated Assets. Click a material to open it and tweak (e.g. its base colour). Edits persist across reimports — the importer only (re)generates missing materials. A full Reimport clears the cache to regenerate everything from source.

Import settings

Selecting a texture or model shows an Import Settings panel (Unity-style):

  • Image — texture type (default / normal map / sprite / UI / HDR), color space, mipmaps, compression, filter, wrap, max size.
  • Model — import materials, import animations, scale factor.

Settings are stored in the .meta; Apply re-cooks the asset.

External vs embedded textures

  • External images (a glTF that points at sibling .png/.jpg files) become ordinary texture assets with their own .meta — so you can select and swap them like any other asset.
  • Embedded images (GLB binary chunks, or base64 data URIs) are extracted into cache-only texture assets during import.

Either way the generated material binds each map by GUID. Common formats (PNG, JPEG, …) are decoded to RGBA8.

Texture formats

Format Path
PNG / JPEG / BMP / TGA / WebP Decoded to RGBA8 (stb_image).
KTX2 (.ktx2) GPU block formats uploaded directly — BCn passthrough, Zstandard inflated, and Basis Universal (ETC1S / UASTC) transcoded to BC7. Mip levels are preserved.

KTX2 support lives in a standalone, engine-independent ktx2 module (with a vendored Basis Universal transcoder), slotted in behind loadTexture so materials and importers stay format-agnostic.


PBR materials

A .material is a small JSON asset that references a shader by GUID and stores values for the parameters that shader exposes. The built-in PBR (Metallic-Roughness) shader exposes:

Parameter Kind Notes
base_color color albedo tint (RGBA)
metallic, roughness scalar 0–1
emissive, emissive_strength color / scalar
normal_scale, occlusion_strength scalar
alpha_cutoff scalar for masked transparency
albedo_map, metallic_roughness_map, normal_map, emissive_map, occlusion_map texture bound by GUID

Because a generated material is a normal asset, you can edit it in the inspector or swap a mesh to a different material without touching the model. When you set a MeshRenderer's mesh to a model and its material is still empty, Turian fills it with the model's primary generated material automatically.

You can also create materials from scratch via the asset browser, including built-in presets (Default, Metal, Plastic, Emissive, Glass).


Example

The 3d-model-materials example shows three objects side by side: an OBJ cube with a built-in Metal preset, the Khronos WaterBottle as glTF (external .png maps), and the same bottle as GLB (embedded maps extracted on import). It is structured to scale up to large scenes such as Sponza or Bistro — drop the model into assets/models/, open the project, and add it to a scene.

See also Component Reference for the MeshRenderer component and Project Settings for the boot scene.


← All docs Edit this page