||Renderable game objects
SCENE files (also known as SCENEGRAPHS) are MBIN files used as containers for object references in the game. They can reference a lot of things - including entities, effects, additional scenes, meshes, and so forth. Using these SCENE files, you can attach scripts and objects together into one form, like a prefab.
All objects in the game are spawned from SCENE files (plants, ships, and even your multitool). As you will eventually find out, SCENE files are extremely powerful and can be used for more than just stringing objects together.
For those already used to game development, SCENE files are similar to Unity GameObjects - they are containers that reference models, sounds, scripts, and more.
Each SCENE file contains Scene Nodes (TkSceneNodeData) which is a complete data structure that defines the basic structure of a SCENE. These include:
- Name - the name of the scene file. The root node of the scene file usually bears the directory and the name of the scene itself i.e. a DRONE.SCENE has the name "MODELS\COMMON\ROBOTS\DRONE"
- Type - the type of Scene Node. They are all listed in Types of Scene Nodes. This structure will influence the attributes declared within in the Attribute container.
- Transform - the vector3 (x, y, z) position, rotation, and scale of an object in relation to its parent.
- Attributes - depending on the Scene Node Type, different fields will be declared here along with their corresponding values. Each attribute has a Name, AltID, and Value. The AltID is usually empty.
- Children - each Scene Node can have more scene nodes as children.
Types of Scene Nodes
- MODEL - this Scene Node Type references a GEOMETRY MBIN. Most SCENE files have this as the type used for their root node.
- GEOMETRY - this one single property simply references a GEOMETRY MBIN file (i.e. "MODELS\COMMON\ROBOTS\DRONE.GEOMETRY.MBIN"). These files are also serialized XML, containing 3D models for the game.
- NUMLODS - The total number of Levels of Detail for this scene. This enables simplified objects to be displayed at distance. See LODLEVEL.
- LODDIST[X] - eg. "MODELS\TESTS\LODTEST\TREELOD.SCENE.MBIN" - the distance at which to switch to a higher level of detail.
- LOCATOR - an empty node that simply holds transform data. These can be used quite heavily by ENTITY files for a number of things such as interactions being placed at specific locations with them as well as things like the location of the scanner icon if your object is scannable or the point from a gun model from which projectiles are shot from. They are also used to contain meshes at different levels of detail.
- REFERENCE -eg. MODELS\TESTS\JETPACKTEST\TESTYBOY.SCENE.MBIN - These nodes generally collect child nodes together and contain references to external files. The parent is usually a JOINT node to which this external Prefab is attached. This gives a lot of flexibility, as it allows you to create a custom object and place already existing objects from the game into your scene. This referenced scene will be procedural if it is able to be (ie. if it has an associated descriptor, and the scene you are referencing it from is being called procedurally). If you want to avoid a scene being called procedurally, you can specify an AltID. This is a list of the names of nodes with space between them to specify exactly what parts you want. The model viewer can export AltID's for objects, so if you load a scene with it, you can set only the parts of the scene you want to be visible and then export the AltID and put this value here to reference that exact scene configuration.
- SCENEGRAPH - the relative path to the desired SCENE.
- MESH - eg. MODELS\TESTS\SIMPLEPLANE.SCENE.MBIN - this Scene Node Type explicitly takes mesh data from a root node's referenced GEOMETRY file to be displayed in-game. It is important to note that mesh data is obviously not supposed to be manually written by a human. See the Importing Custom Models page to see how this is done.
- LODLEVEL - The index for this mesh's level of detail
- Object bounds (?): AABBMINX, AABBMINY, AABBMINZ, AABBMAXX, AABBMAXY, AABBMAXZ
- MATERIAL - path to the material file this mesh uses.
- ATTACHMENT - a path to the ENTITY MBIN this mesh uses. ENTITY files are MBIN's that define behaviors or interactions.
- MESHLINK - reference to the name of another mesh that has an important relationship
- COLLISION - eg. MODELS\TESTS\PHYSICSMESH.SCENE.MBIN - this Scene Node Type is responsible for rendering collisions for objects with a wide array of options possible. Much like the MESH node type, data here is usually created during the import of custom models.
- TYPE - collisions can be in the form of meshes, or use more performance-efficient shape primitives provided by the engine
- Sphere - The collision will be a round ball.
- Cylinder - The collision will be a straight tube.
- Capsule - The collision will be a straight tube with half spheres at each end.
- Mesh collision - The collision will be the object's meshes.
- JOINT - eg. MODELS\TESTS\MATERIALTESTS\SKINNEDOBJECT.SCENE.MBIN - a point in the model's animation rig
- TRANSFORM - vector of point from parent. The top joint is in relationship to the origin.
- JOINTINDEX - reference for vertex weights
- ATTACHMENT - an ENTITY file related to this joint
Light and effect nodes
- LIGHT - allows a light source to be attached to the SCENE file. RGB stands for Red Green Blue. If all three channels are set to 255, the displayed color will be white.
- FOV - controls the arc of a light's emission (light bending). The value "90" will create a 90-degree spotlight, while the value "360" replicates what a standard point light would do.
- FALLOFF - controls how light fades away over distance.
- INTENSITY - controls the light's brightness. A low value will make the light shine a little bit and appear as darker, while a high value will make the light shine a lot and will appear brighter)
- COL_R - Red color channel's component. Values are set between 0 and 1 ; 0 being the lowest value (black) which equals to 0/255 , 1 being the highest value which equals to 255/255.
- COL_G - Green color channel's component. Values are set between 0 and 1 ; 0 being the lowest value (black) which equals to 0/255 , 1 being the highest value which equals to 255/255.
- COL_B - Blue color channel's component. Values are set between 0 and 1 ; 0 being the lowest value (black) which equals to 0/255 , 1 being the highest value which equals to 255/255
- EMITTER - eg. MODELS\EFFECTS\PLAYER\FOOTSTEPEFFECTS\FOOTSTEP_DUST.SCENE - controls particles emitted from object
- DATA - eg. MODELS\EFFECTS\CREATURES\CRYSTALAURA\EMITTERS\CRYSTALAURAEMITTER.PARTICLE.MBIN - the physics of the particles