• Assets

Alembics

By: SKY ENGINE AI
scroll down ↓to find out more

Alembic archives

The main format used in Sky Engine for carrying information about scene definition: models and their relative
positions (or position ranges for randomization) is Alembic (.abc).
Alembic exchange format developed by Sony Pictures Imageworks and Lucasfilm is widely used in the industry
and is supported by most of the modern CG tools.
Alembic file format can contain locators, geometries and cameras organized in a tree.

Agenda:

  • Sky Engine Alembic naming convention
  • Additional parameters
  • Instancing
  • Scene setups example

Sky Engine Alembic naming convention

If you'd like to prepare an arbitrarily complicated scene that can be automatically with no further configuration
loaded and organized in the Sky Engine Renderer, you need to follow the guidelines below.

The function and meaning of files and nodes building a scene is controlled by name suffixes. We have defined 7
file name suffixes and 5 node name suffixes.

Possible file name suffixes:

  • SCN - scene file,
  • COL - collection file,
  • GEO - geometry file,
  • CAM - camera file,
  • STS - surface sampler file,
  • VTS - volume sampler file,
  • ITS - instancer sampler file.

Possible node name suffixes:

  • ROOT - a collection locator and collection file attachment point,
  • GEO_NUL - geometry locator and geometry file attachment point,
  • CAM_NUL - camera locator and camera file attachment point,
  • LIGHT_NUL - light locator,
  • NUL - general purpose empty locator.

Of course, you don't need to use all of them in a scene. As you've seen above, three files: SCN, GEO and CAM
are sufficient to create a scene with an animation, light and camera already encoded.

Special node names can indicate the name of the file that should be attached there. For example, when you see
the example_ROOT node in the SCN file, you can expect to find an example_COL.abc file in the same folder.
Similarly, player_GEO_NUL node is a place, where a player_GEO file is attached. CAM_NUL node and CAM file
are analogous.

LIGHT_NUL and NUL nodes don't indicate additional files. LIGHT_NUL is just a locator for a light, white sphere
light is put there automatically if you load a full Alembic scene. NUL node is used when some location needs to
be specified, but it's not a light, geometry, camera or collection locator - for example the point the camera
looks at, camera target.

HINT: If you use a special NUL node name camera_target_NUL it will be interpreted automatically
as camera target.

SCN file

This is a starting point for the Alembic scene parsing. If you use just a folder name to load the Alembic scene,
the SCN file is automatically found inside.

There can be only one SCN file for a scene and the SCN file must be flat. If you want to create a multi-level
scene you have to use ROOT nodes and COL files (see below).

This file provides attachment points for all the other files, so you can find all the special nodes there
(ROOT, GEO_NUL, CAM_NUL, LIGHT_NUL, NUL).

COL file

Collection file extends the SCN functionality - it's basically another SCN file that starts at a ROOT node.
You can use the ROOT nodes inside the COL files too, so the scene can have arbitrarily complicated,
arbitrarily deep structure.

GEO file

Geometry file - it must contain one geometry (mesh) node. If there are any corrective transformation inside,
like scale change, axis rotation they will be applied during loading. Such corrections are sometimes automatically
applied by the graphic software. However, this feature should never be abused to move the geometry - the position
of the geometry must be controlled by its GEO_NUL node.

GEO file can also contain the keypoints of its mesh. All the locators that are siblings of the mesh node in the
GEO file are interpreted as keypoints. The keypoint node names are also special, but they depend on
the keypoint configuration, so there is no one general rule. For example, the names we assigned for the COCO
person keypoints convention are KP_Ankle_L, KP_Ankle_R, KP_Knee_L, KP_Knee_R etc.

CAM file

Camera file must contain one camera object as defined by Alembic standard with the camera properties.

STS, VTS, ITS files

The sampler files - STS, VTS, ITS - are a bit different. They describe how the node they are attached to behaves.
Each of them has a mesh geometry that describe this behavior.

For example, STS file, surface transformation sampler, randomizes the transformation of the node it is attached
to on a surface of a mesh it has inside. It uses three coordinates: frame number (mesh can be animated)
and the UV coordinates of the mesh. You can think of it as of reversed texturing: instead of using UV coordinates
of the given point on a mesh to put a texture on it, we use UV coordinates to find a position on a mesh.

The mechanism is very similar for VTS and ITS files. VTS, volume transformation sampler, has one more coordinate.
It uses frame number, UV coordinates and the distance from the meshes' local (0, 0, 0) point. This way it can
sample the 3D transformation inside the mesh - in its volume.

Instancer transformation sampler, ITS, takes a bit of different approach. Its purpose is to enable using
mesh's triangles as spots of node instancing. As coordinates, it uses frame number, triangle number
and its barycentrics. This way, if you want to instance the node (and everything that's below in a tree)
at once at the precisely defined N places, you can use a mesh with N triangles, use it as ITS
and choose a different triangle number for each instance.

STS, VTS and ITS can be attached to the same node as other file. Let's say you have a player and a mesh of a pitch
it can stand on randomly. You use files player_GEO.abc, containing player mesh, and player_STS.abc,
containing the pitch mesh. They will both automatically attach to the node player_GEO_NUL.

Another example: you have a flying insect you want to put inside a swarm mesh and multiply it there millions
of times. You can put an insect_GEO_NUL node to the SCN or COL file and then prepare an insect_GEO.abc file
with the insect mesh and an insect_VTS.abc file with a swarm mesh. The insect transformation will be sampled
inside automatically. Now you just have to specify the instance_count to get millions of insects.

You can use this table as a quick reference:

File name suffixPurposePossible parent nodesPossible nodes insideNode names inside matterLimitations
SCNStarting point for the scene.-ROOT, GEO_NUL, CAM_NUL, LIGHT_NUL, NULYesOnly one per scene. <br>Must be flat.
COLCollection of nodes, scene substructure.ROOTROOT, GEO_NUL, CAM_NUL, LIGHT_NUL, NULYesMust be flat.
GEOGeometry (mesh). Can have keypoints.GEO_NULMesh node and its parent locators. <br>Keypoint locators - mesh's siblings.Only keypoints'Must have one mesh node inside.
CAMCamera definition.CAM_NULCamera node and its parent locatorsNoMust have one camera node inside.
STSSamples parent locator's transformation on a surface.ROOT, GEO_NUL, CAM_NUL, LIGHT_NUL, NULMesh node and its parent locatorsNoMust have one mesh node inside. <br>Must have UV layout.
VTSSamples parent locator's transformation in a volume.ROOT, GEO_NUL, CAM_NUL, LIGHT_NUL, NULMesh node and its parent locatorsNoMust have one mesh node inside. <br>Must have UV layout.
ITSInstances parent locator on mesh surface based on UV.ROOT, GEO_NUL, CAM_NUL, LIGHT_NUL, NULMesh node and its parent locatorsNoMust have one mesh node inside. <br>Must have UV layout.

Additional parameters

Above we gave an example for STS file to use the pitch mesh as a surface the player is sampled on. Isn't it
an overkill for this purpose? STS file is perfect to sample objects on complicated surfaces, for a flat surface
it would be easier to define just the translation range for X and Y axes.

For this reason we are also supporting the addition parameters saved in json files.

HINT: If you are using Blender for asset exporting, you can add these parameters as "Custom Properties"
of the node. Then, when you use the Sky Engine Alembic Exporter plug in, they will be automatically verified
and saved to the json file.

We support following parameters:

  • #t_range_x, #t_range_y, #t_range_z - translation range for each axis,
  • #r_range_x, #r_range_y, #r_range_z - rotation range for each axis,
  • #s_range_x, #s_range_y, #s_range_z - scale range for each axis.

Each range must be just one number - the range always start from zero and the parameter number is the upper
limit of the range
. Just remember to prepare the asset controlled by these parameters in the lower
end of translation, rotation, scale limits.

Parameters json example:

stadium_SCN.json

{ "player_GEO_NUL": { "#t_range_x": 65, "#t_range_y": 100, "#r_range_z": 360 }, "camera_target_NUL": { "#t_range_y": 80 } }

This file goes together with stadium_SCN.abc file. The settings for player_GEO_NUL replace the need for STS file
(translation ranges) and additionally enable free rotation of the player along Z axis (360 degrees). Camera target
locator, camera_target_NUL, also has randomized position, that will cause some camera movement without the need
of further configuration.

Instancing

There are three possibilities to easily instance one node multiple times. Two were already mentioned,
let's see all of them:

  • use ITS file,
  • use STS file, VTS file or parameters to allow node transformation randomization and multiply the node
    using n_instances setting during scene configuration,
  • use multiple nodes with suffixes for the same file.

The third one is new and the simplest. Let's say you have a goal geometry goal_GEO.abc and you want to put it
on two ends of the pitch. Just add the number to the node name in SCN or COL file! The first location would be
called goal_GEO_NUL_000 and the second - goal_GEO_NUL_001. There are three digits because that's the default
behavior, but of course goal_GEO_NUL_0 and goal_GEO_NUL_1 would also work just fine.

Scene setups example

You will see just one SCN file, lots of GEO files and one CAM file. There are no COL files, so all the GEO_NUL
nodes must be in this one SCN file. The SCN file has also accompanying json file. Let's look inside.

import json from skyrenderer.cases.utils.scene_composer import SceneComposer from skyrenderer.core.asset_manager.asset_manager import AssetsTypes scene_composer = SceneComposer(antialiasing_level=1) rugby_player_folder = scene_composer.renderer_context.get_abs_path("stadium", AssetsTypes.ANIMATIONS) for file_path in rugby_player_folder.glob("."): scene_composer.log_info(file_path.name) scene_composer.renderer_context.add_alembic_files(["stadium/stadium_SCN.abc"]) scene_composer.log_info( f'stadium_SCN\n{scene_composer.renderer_context.abc_archive_manager.get_archive_info("stadium_SCN")}' ) with scene_composer.renderer_context.get_abs_path("stadium/stadium_SCN.json", AssetsTypes.ANIMATIONS).open() as f: scene_composer.log_info(f"\n{json.dumps(json.load(f), indent=4)}")
2025-01-29 13:47:30,405 | skyrenderer.scene.renderer_context | INFO: Root paths: - root path: /dli/skyenvironment/skyrenderer/skyrenderer - assets path: /dli/mount/assets - config path: /dli/skyenvironment/skyrenderer/skyrenderer/config - gpu sources path: /dli/skyenvironment/skyrenderer/skyrenderer/optix_sources/sources - cache path: /dli/mount/cache - ptx cache path: compiled_ptx/ptx - ocio path: ocio_configs/aces_1.2/config.ocio 2025-01-29 13:47:30,435 | skyrenderer | INFO: rugby_pitch_GEO.abc 2025-01-29 13:47:30,436 | skyrenderer | INFO: bumper_GEO.abc 2025-01-29 13:47:30,436 | skyrenderer | INFO: grass_GEO.abc 2025-01-29 13:47:30,437 | skyrenderer | INFO: crowd_GEO.abc 2025-01-29 13:47:30,437 | skyrenderer | INFO: logo_adidas_GEO.abc 2025-01-29 13:47:30,438 | skyrenderer | INFO: stripes_GEO.abc 2025-01-29 13:47:30,439 | skyrenderer | INFO: screen_GEO.abc 2025-01-29 13:47:30,439 | skyrenderer | INFO: stadium_base_GEO.abc 2025-01-29 13:47:30,440 | skyrenderer | INFO: player_GEO.abc 2025-01-29 13:47:30,440 | skyrenderer | INFO: stadium_SCN.json 2025-01-29 13:47:30,441 | skyrenderer | INFO: stadium_details_GEO.abc 2025-01-29 13:47:30,441 | skyrenderer | INFO: camera_CAM.abc 2025-01-29 13:47:30,442 | skyrenderer | INFO: grass_baners_GEO.abc 2025-01-29 13:47:30,443 | skyrenderer | INFO: banners_GEO.abc 2025-01-29 13:47:30,443 | skyrenderer | INFO: stadium_SCN.abc 2025-01-29 13:47:30,763 | skyrenderer | INFO: stadium_SCN ABC |--bumper_GEO_NUL_000 |--bumper_GEO_NUL_001 |--bumper_GEO_NUL_002 |--bumper_GEO_NUL_003 |--light_L01_LIGHT_NUL |--light_L02_LIGHT_NUL |--light_L03_LIGHT_NUL |--light_L04_LIGHT_NUL |--player_GEO_NUL |--rugby_pitch_GEO_NUL_000 |--rugby_pitch_GEO_NUL_001 |--screen_GEO_NUL |--banners_GEO_NUL |--crowd_GEO_NUL |--grass_baners_GEO_NUL |--grass_GEO_NUL |--logo_adidas_GEO_NUL |--stadium_base_GEO_NUL |--stadium_details_GEO_NUL |--stripes_GEO_NUL |--camera_CAM_NUL `--camera_target_NUL 2025-01-29 13:47:30,764 | skyrenderer | INFO: { "player_GEO_NUL": { "#t_range_x": 65, "#t_range_y": 100, "#r_range_z": 360 }, "camera_target_NUL": { "#t_range_y": 80 } }

You can note that:

  • the node structure inside is flat - as required in SCN and COL files,
  • there are GEO_NUL nodes for each GEO file in the folder and CAM_NUL for the CAM file,
  • there is a NUL node used as a camera target,
  • the bumper_GEO.abc will be instanced in four places, rugby_pitch_GEO.abc in two,
  • there are four lights - four LIGHT_NUL nodes,
  • translation and rotation range of player_GEO_NUL and translation range of camera_target_NUL
    are defined in json file.
scene_composer.renderer_context.add_alembic_files(["stadium/player_GEO.abc", "stadium/camera_CAM.abc"]) scene_composer.log_info( f'player_GEO\n{scene_composer.renderer_context.abc_archive_manager.get_archive_info("player_GEO")}' ) scene_composer.log_info( f'player_GEO\n{scene_composer.renderer_context.abc_archive_manager.get_archive_info("camera_CAM")}' )
2025-01-29 13:47:30,773 | skyrenderer | INFO: player_GEO ABC `--player_GEO_NUL |--KP_Ear_R |--KP_Ear_L |--KP_Nose |--KP_Eye_L |--KP_Eye_R |--KP_Shoulder_R |--KP_Elbow_R |--KP_Wrist_R |--KP_Shoulder_L |--KP_Elbow_L |--KP_Wrist_L |--KP_Hip_R |--KP_Hip_L |--KP_Knee_R |--KP_Knee_L |--KP_Ankle_R |--KP_Ankle_L `--player_GEO `--player_GEOShape 2025-01-29 13:47:30,774 | skyrenderer | INFO: player_GEO ABC `--camera_CAM `--camera_CAMShape

You can see the mesh node and keypoints inside (see: SYSTEM_Keypoints tutorial). Here it looks like the
keypoints are one level lower than the mesh node (player_GEOShape). In Blender, player_GEO and player_GEOShape
nodes are merged (player_GEO is used to hold the transformation of the shape moved by the artist). Therefore, if
the artist prepares keypoints as mesh siblings, in the more detailed structure here they are mesh's parent's
siblings.
Camera consist of one simple camera node and a locator.

Summary

In this section you have learnt:

  • Alembic format is the main format for storing information of scene definitions in SkyRenderer.
  • There are a few suffixes for file names and node names allowing automatic load of robust scenes.
  • Additional files like .json and instancing files may be used to manage additionally transformations of nodes.