# Resource formats ## Dictionary format ``` [kkkk vvvv KK... VV...]... ^ ^ ^ ^ | | | | value | | | key | | 16-bit kalue length | 16-bit key length ``` ## PrefabIndex | Key | Value Type | | -------- | ---------- | | \ | `Res` | ## Prefab | Key | Value Type | | | ------------- | -------------------------------------- | --------- | | `mesh` | `Matrix3`, `Vec3`, `Res` | Multi key | | `collision` | `Matrix3`, `Vec3`, `Res` | Multi key | | `light` | `Vec3`, `Res` | Multi key | | `environment` | `Res` | | ## MeshPart Vertex attribute arrays (va_\*) are resources that contain a packed float32 array. ombinations of g_\*, va_\* and tex_\* are multiplied except normal which is added. Defaults should be the identity for that operation, so default is 1 / white except normals are zero. | Key | Value Type | | | -------------------- | -------------- | ------------------ | | `name` | `String` | | | `index` | `Res` | | | `g_metallic` | `Float` | | | `g_roughness` | `Float` | | | `g_albedo` | `Vec3` | | | `g_alpha` | `Float` | | | `g_transmission` | `Float` | | | `g_emission` | `Vec3` | | | `g_refractive_index` | `Float` | | | `g_attenuation` | `Vec3` | | | `g_dispersion` | `Float` | | | `g_thickness` | `Float` | | | `g_unlit` | | | | `g_double_sided` | | | | `va_position` | `Res<[Vec3]>` | | | `va_normal` | `Res<[Vec3]>` | | | `va_texcoord` | `Res<[Vec2]>` | | | `va_roughness` | `Res<[Float]>` | | | `va_metallic` | `Res<[Float]>` | | | `va_albedo` | `Res<[Vec3]>` | | | `va_alpha` | `Res<[Float]>` | | | `va_transmission` | `Res<[Float]>` | | | `va_emission` | `Res<[Vec3]>` | | | `tex_normal` | `Res` | Use color channels | | `tex_roughness` | `Res` | Use green channel | | `tex_metallic` | `Res` | Use blue channel | | `tex_albedo` | `Res` | Use color channels | | `tex_alpha` | `Res` | Use alpha channel | | `tex_transmission` | `Res` | Use red channel | | `tex_emission` | `Res` | Use color channels | | `tex_thickness` | `Res` | Use green channel | | `tex_occlusion` | `Res` | Use red channel | - **Attenuation**: Attenuation coefficient for each color channel due to scattering within the material volume expressed as e-folding distance (m^-1). See [KHR_materials_volume]. - **Transmission**: Equivalent to `transmissionFactor` and `transmissionTexture` of [KHR_materials_transmission]. - **Refractive Index**: Equivalent to `ior` of [KHR_materials_ior] - **Thickness**: Equivalent to `thicknessFactor` and `thicknessTexture` of [KHR_materials_volume]. - **Dispersion**: 20 / Abbe Number. Equivalent to `dispersion` of [KHR_materials_dispersion]. - **Unlit**: Directly transfers \*_albedo to the screen if set. No lighting shaders are applied. See [KHR_materials_unlit] - **Double Sided**: Disable backface culling for this mesh. Equivalent to `material.doubleSided` of glTF 2.0. ## LightPart | Key | Value Type | | ---------- | ------------------------ | | `radius` | `Float` | | `emission` | `Vec3` | | `spot` | `Vec3`, `Float`, `Float` | - **Emission**: Luminous intensity in candela per channel. Equivalent of `color` multiplied with `intensity` of [KHR_lights_punctual]. - **Radius**: Radius for soft shadow calculation. If set, the light source can be modelled to be a light emitting sphere of that radius. Not suported by glTF. - **Spot**: Normalized direction vector, inner and outer cone radius like `innerConeAngle` and `outerConeAngle` in [KHR_lights_punctual]. ## EnvironmentPart | Key | Value Type | | | -------- | -------------- | ---------------- | | `skybox` | `Res` | | | `sun` | `Vec3`, `Vec3` | Direction, Color | ## Texture WebP ## CollisionPart Only one key for shape should be set. | Key | Value Type | | | ------------------- | ------------------------- | -------------------------- | | `restitution_coeff` | `Float` | | | `friction_kinetic` | `Float` | Coeffient | | `friction_static` | `Float` | Coeffient | | `sh_box` | `Vec3` | Side lengths | | `sh_sphere` | `Float` | Radius | | `sh_cylinder` | `Float`, `Float`, `Float` | Bottom/Top Radius, Height | | `sh_capsule` | `Float`, `Float`, `Float` | Bottom/Top Radius, Height | | `sh_convex_hull` | `Res<[Vec3]>` | Convex hull points | | `sh_mesh` | `Res`, `Res<[Vec3]>` | Mesh index + vertex buffer | [KHR_materials_transmission]: https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_materials_transmission [KHR_materials_ior]: https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_materials_ior [KHR_materials_volume]: https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_materials_volume [KHR_materials_dispersion]: https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_materials_dispersion [KHR_lights_punctual]: https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_lights_punctual [KHR_lights_unlit]: https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_lights_unlit