Skip to main content

Scene

Tellusim Scene format fully describes all supported scene types. Scenes can be loaded either synchronously or asynchronously using the SceneStream interface.

Scenes can be saved in Xml, Json, or binary formats:

  • Xml scenes are typically saved as *.scenex files.
  • Json scenes are typically saved as *.scenej files.
  • Binary scenes are typically saved as *.sceneb files.

Xml and Json formats are ideal for development, as they can be manually edited and easily merged in version control systems. The binary format is recommended for release builds due to significantly faster loading times and reduced file size.

info

Tellusim Explorer is a scene editor for inspecting and editing scene files.

info

Each scene file includes the engine version and supports automatic format evolution.

A typical scene file contains definitions for Material, Body, Object, Camera, and Graph instances. Each instance is assigned a unique id for fast internal referencing during loading.

While it is possible to store an entire project in a single scene file, this approach is not recommended for large projects, as it may lead to conflicts during collaborative development. Instead, scenes can be split into separate Graph and Node files following the same format conventions:

  • *.graphx - Xml graphs
  • *.graphj - Json graphs
  • *.graphb - Binary graphs
  • *.nodex - Xml nodes
  • *.nodej - Json nodes
  • *.nodeb - Binary nodes

Each Scene Graph or Node can reference external *.graph or *.node files. Graph files can have multiple roots while Node files contain only a single root element. These Graph and Node files store all necessary resources and can be opened independently.

info

External references to Graph and Node files are more efficient than embedding, especially when multiple instances are used. Only the first reference triggers a loading operation; subsequent references use cloned instances.

info

Object geometry data can be embedded directly into the scene file, which is recommended for release builds to improve loading performance.

info

Asynchronous loading of *.graph files is ideal for streaming large levels.

Examples

The following example shows a self-contained galaxy.nodex file that defines custom material parameters, high-level geometry information, and references to galaxy.shading and galaxy.mesh files:

<?xml version="1.0" encoding="utf-8"?>
<node>
<version>20230725</version>
<node id="1" type="4" type_name="Object">
<name>Galaxy</name>
<local_transform>0.819152057171 0.55403226614 0.148452505469 -0.573576450348 0.791240096092 0.212012141943 1.591994453898e-17 -0.258819043636 0.965925812721</local_transform>
<object id="2" type="1" type_name="Mesh">
<name>Galaxy</name>
<masks>ffffffff ffffffff 1 0 ffffffff 0 ffffffff ffffffff</masks>
<bound_box>-1.0e5 -1.0e5 -1.0e5 1.0e5 1.0e5 1.0e5</bound_box>
<num_geometries>1 1</num_geometries>
<geometry id="3" type="2" type_name="Mesh">
<name>Galaxy</name>
<bound_box>-1.0e5 -1.0e5 -1.0e5 1.0e5 1.0e5 1.0e5</bound_box>
<num_materials>1</num_materials>
<material id="4" type="6" type_name="Shading">
<shading_name>shaders/galaxy.shading</shading_name>
<name>Galaxy</name>
<num_uniforms>1</num_uniforms>
<uniform>
<name>galaxy_scale</name>
<size>1</size>
<data>0.5</data>
</uniform>
<order>10</order>
<pass_mask>3</pass_mask>
<deferred_mask>64</deferred_mask>
</material>
<num_indices>960</num_indices>
<num_vertices>162</num_vertices>
<num_batches>1</num_batches>
<batch>
<num_indices>960</num_indices>
<num_vertices>162</num_vertices>
</batch>
</geometry>
<mesh_name>meshes/galaxy.mesh</mesh_name>
<mesh_flags>ver,tri</mesh_flags>
<vertex_stride>12</vertex_stride>
</object>
</node>
</node>