Toybox

Starting With the Toybox Source Code to Create Custom Channels

The Toybox channel uses Blender for physics-based image simulation and 3D modeling. The Toybox source code can serve as a starting point to create custom synthetic data applications utilizing key Rendered.ai features.

Source Code: https://github.com/Rendered-ai/toybox

Synthetic data engineers can use the Toybox channel source code to learn how Rendered.ai channels are used to control scene objects, lights, cameras, as well as custom metadata collection. The Toybox channel has nodes that randomize the 3D scene for any run on the Rendered.ai platform, including, changing the color of objects and performing a gravity simulation. Additionally, the source code contains examples of node tool tips and graph validation rules that help guide the user create graphs.

Rendered.ai Channel Architecture

Terms used when discussing channel development are detailed in the Ana Software Architecture of the Development Guides

Basic components

In particular, it is useful to be familiar with packages, package volumes, nodes, schema, and base classes.

PackagesPackage VolumesNodesSchemaAna Modules, Classes, and Functions

The Toybox channel uses several common nodes for random numbers and data volume access. The full list of common nodes from the anatools package are documented here:

The anatools Package

Toybox Modules

Channels can implement randomization for dataset generation with Blender scene composition, rigid body simulation, and rendering. Channel developers design what randomization control should be exposed to the user vs hard coded in the node logic. Users control randomization by choosing nodes and setting node inputs. For example, the Toybox channel allows users to control the height and roll of the camera, but not the X, Y offset. The offsets are also randomized, but the limits were chosen to be estimated in the channel code to maximize their range for an expected result.

The “object_generators” module makes use of Rendered.ai object generators, factories that instantiate objects as needed for a given run. Similarly, the “color_variation_modifier” module makes use of Rendered.ai modifier generators.

The “random_placement” module contains two different placement nodes that uses Blender’s rigid body world settings to achieve natural placement of the toys as if dropped under the influence of gravity. One node one scatters the toys on the floor, the other drops them into a container.

The “simulate” module contains a nodes for Blender lights, cameras, and the Render node, which is required for all graphs. The Render node inputs the object of interest to be annotated, sets up the Blender compositor, and renders images and truth masks.

Variation by User Provided Data

Rendered.ai graphs can run on user uploaded data, including 3D models. To accommodate this, the Toybox channel uses two nodes from the common package: “VolumeFile” and “VolumeDirectory”. These access workspace volumes and allow users to add their Blender objects to a graph for synthetic data generation.

User Experience

Channel developers configure the channel UX in the node schema. The node schema stores node tooltips, field descriptions, and graph validation.

SchemaGraph Validation

The following screenshot of a graph in the Toybox channel shows the Color Variation node without a required link to the “Generators” field. This shows the user the graph will not run and why.

Using the Source Code

The Developer Guide has tutorials on adding modifiers and object generators to the Toybox channel.

An Example Channel - Toybox

To navigate the code, start by setting up a development environment as described in

Setting Up the Development Environment

In the development environment, channels can be edited and deployed to a Rendered.ai organization.

Last updated