Assets

Scene Creation

Rayve does not have a dedicated level editor. Instead, 3D modeling tools are used to create and export scenes to Rayve using FBX files and Rayve specific naming conventions.

Iterative Workflow

Begin by adding as much or as little to a scene as desired, or just grey-boxing. If different modeling tools are used, import and position the models into one main scene. Keep all materials for a mesh or prefab in a folder alongside the mesh or prefab's modeling tool file.

When ready to move the scene into the engine, copy any new or changed materials to the project's data folder. Then export the scene from the modeling tool to an FBX file in the same data folder.

The game can now be started. The importer will detect the new files and attempt to convert them to internal compressed files. Once converted, the new files will be deleted from the data folder. The new scene will then be loaded into the engine. If all is successful, the new scene can be tested in the engine. If more changes are needed, a new iteration begins.

Exporting

FBX files are used for mesh import. Exporting to .fbx often requires trial and error for imports to work correctly. In general, scale meshes by .01 on export and leave the axis system the same as the modeling tool. If export options are available to convert meshes to triangles and/or calculate tangents, use those options. These are guidelines and experimentation may be needed.

Importing

Assets must be converted to an internal compressed format before they can be used by the engine. The engine will import any asset changes when the game starts. Importing is enabled in the debug DLL and disabled in the release DLL.

Import progress will be output while an import is running. The progress codes are:

Files:

v = Entering a subfolder
^ = Leaving a subfolder
[P:] = Prefab
M = Material
G = Geometry
I = Image
F = Font
S = Sound

Prefab Contents:

L = Light
C = Camera
G = Geometry
F = Field
S = Collision shape
D = Directory
U = Unknown

Data Folder

A 'data' folder must be located with the excecutable. The data folder is for imported assets used with the game.

To import an asset, export the asset from the content tool into the data folder. When the importer runs, the asset will be converted to internal data and the original exported file will be deleted. If internal data already exists that matches the asset being imported, the internal data will be replaced.

Use any folder structure for organizing the assets.

Accepted file types: .fbx, .png, .ogg, .ttf.

Some assets can be slow to import based on the asset type and settings.

Images

Only .png files are supported. To import an hdri environmental background image, add the target image size to the file name, then add '.hdri'. For example, "mybgd.2048.hdri.png".

Sounds

Only .ogg files are supported. If a sound file is for streaming, it requires a ".stream" qualifier in the name. For example, mysound.stream.ogg".

Fonts

Only .ttf files are supported. A font file should have a .txt file with it of the same name, that specifies the font size for the font.

The parameters are a keyword followed by one or more values:

imagesize [width] [height]
fontsize [font size in points]
firstchar [index of first character in table]
lastchar [index of last character in table]
linegap [number of pixels between lines]

Only the fontsize is used typically.

Materials

The importer can import sets of textures with the same material name and convert them into PBR materials.

For the importer to recognize materials, they must be in a folder that ends with .fbm. For example, * 'mymats.fbm'. Any number of materials folders can supplied, but a materials folder should not contain subfolders, as they are ignored.

Important: All material names must be unique within a scene.

The texture files in the materials folder must be named so that the material name comes first followed by the PBR role name. A PBR role name is the textures's PBR function, such as albedo, normal, etc. All material texture files having the same material name are combined into one PBR material when imported.

There is no consistant standard for PBR role names. The importer can use a 'cvtmat.txt' file that contains a rule on each line that tells the importer how to convert PBR role names to the names Rayve recognizes.

The format is:

"Original PBR role name" "Rayve's recognized name"

Rayve's recognized name must start with an underscore. For example:

"basecolor" "_albedo"
"base-color" "_albedo"
"albedo" "_albedo"

There must always be an entry for Rayve's recognized name as well. Rayve's recognized PBR role names are: albedo, normal, metallic, roughness, emissive, opacity, lucence, trace, refraction, ao. The dimensions of textures used in materials should be powers of 2, but do not have to be square.

Mesh

Meshes must always have scaling baked into the geometry.

If a mesh file contains multiple geometry nodes, all geometries will be combined into a single mesh.

If a mesh file contains animations, the mesh will be converted to an animated mesh internally in Rayve. When converting an animated mesh, a text file will be created in the project/bin folder that contains the names of the animations.

When exporting to .fbx, using the triangulation option and tangents option can speed up importing, often significantly.

All meshes must have uv's, even if the mesh is not using textures, or the import will fail.

Prefab

Rayve is designed around using 3D modeling software for creating scenes instead of a dedicated level editor. Prefabs are used for this purpose. A prefab contains a hierarchy of objects and their positions. It can contain parts of a scene, or an entire scene. The FBX nodes the importer recognizes are null nodes, meshes, lights and cameras.

A prefab mesh has an .fbx extension like a normal mesh, but has .pfb before the file extension, for example "myprefab.pfb.fbx"

Meshes with the same name are instanced in the engine, even if the meshes in the prefab are not instanced.

When importing a prefab, a .txt file will be generated that outlines the prefab hierarchy.

Meshes must not have any scaling in their transform matrix. Any scaling must be baked into the mesh.

Collsion shapes can be any type of mesh in the 3D modeler that helps in visualizing the collision shape. Only the scale/rotation/position of the mesh is used. Collision shapes must be a direct child of a parent node in the hierarchy. Position must be relative to the parent. In contrast to meshes, the size of a collision shape given by the scale factor of the transform and must not be baked in. Multiple collision shapes can be used per base mesh.

Markers are null nodes with 'marker' type. Markers are stored in the prefab and can be accessed by name to get the position of the marker for placing items at that position.

Fields are null nodes with 'field' type used as parent nodes of one or more collision shapes. Fields are used as invisible barriers or sensor objects.

Sounds are null nodes with 'sound' type.

A modeling tool's built in light and camera objects are imported. They can be given a custom type, or can use a default type. These objects might need to be overriden with a custom type and transformed if they do not point in the same direction after import as the modeling tool. Light/camera settings are not imported as they are widely varied in modeling tools. Use custom object types that have specific settings and reference those in the modeling tool.

When objects are grouped in the modeling tool into folders or collections, the grouping is ignored when importing.

Prefab Object Names

Prefab names consist of a name and a type, separated by double underscores. For example, "myname__mytype'. The name identifies a specific object, and the type specifies the catagory of object. The importer ignores objects in the prefab that don't use this naming convention.

Keep names unique so the modeling tool does not add a number after the name. A name can be kept unique by adding a number after the name part of the special prefab name: myname2__mytype. Child objects typically have the same type as parent object, but can be different depending on how they need to be handled.

Automatic Processing

A prefab will automatically create scene entities for the default object types below. Any default collision shapes provided will also be automatically set up. Custom types must be handled by overiding the OnLoadObject() callback.

Object Types:

light
camera
sound
mesh
field

Collision Shapes:

sphere
cube
cylinder
cone
capsule
hull