API

Core Functions

omni.replicator.core.new_layer(name: str = None)

Create a new authoring layer context. Use new_layer to keep replicator changes into a contained layer. If a layer of the same name already exists, the layer will be cleared before new changes are applied.

Parameters

name – Name of the layer to be created. If ommitted, the name “Replicator” is used.

Example

>>> import omni.replicator.core as rep
>>> with rep.new_layer():
>>>     rep.create.cone(count=100, position=rep.distribution.uniform((-100,-100,-100),(100,100,100)))
omni.replicator.core.set_global_seed(seed: int)

Set a global seed.

Parameters

seed – Seed to use as initialization for the pseudo-random number generator. Seed is expected to be a non-negative integer.

Create

omni.replicator.core.create.camera(position: Union[ReplicatorItem, float, Tuple[float]] = None, rotation: Union[ReplicatorItem, float, Tuple[float]] = None, look_at: Union[ReplicatorItem, str, Path, Tuple[float, float, float]] = None, look_at_up_axis: Union[ReplicatorItem, Tuple[float]] = None, focal_length: Union[ReplicatorItem, float] = 24.0, focus_distance: Union[ReplicatorItem, float] = 400.0, f_stop: Union[ReplicatorItem, float] = 0.0, horizontal_aperture: Union[ReplicatorItem, float] = 20.955, horizontal_aperture_offset: Union[ReplicatorItem, float] = 0.0, vertical_aperture_offset: Union[ReplicatorItem, float] = 0.0, clipping_range: Union[ReplicatorItem, Tuple[float, float]] = (1.0, 1000000.0), projection_type: Union[ReplicatorItem, str] = 'pinhole', fisheye_nominal_width: Union[ReplicatorItem, float] = 1936.0, fisheye_nominal_height: Union[ReplicatorItem, float] = 1216.0, fisheye_optical_centre_x: Union[ReplicatorItem, float] = 970.94244, fisheye_optical_centre_y: Union[ReplicatorItem, float] = 600.37482, fisheye_max_fov: Union[ReplicatorItem, float] = 200.0, fisheye_polynomial_a: Union[ReplicatorItem, float] = 0.0, fisheye_polynomial_b: Union[ReplicatorItem, float] = 0.00245, fisheye_polynomial_c: Union[ReplicatorItem, float] = 0.0, fisheye_polynomial_d: Union[ReplicatorItem, float] = 0.0, fisheye_polynomial_e: Union[ReplicatorItem, float] = 0.0, count: int = 1, parent: ReplicatorItem = None) Node

Create a camera

Parameters
  • position – XYZ coordinates in world space. If a single value is provided, all axes will be set to that value.

  • rotation – Euler angles in degrees in XYZ order. If a single value is provided, all axes will be set to that value.

  • look_at – Look-at target, specified either as a ReplicatorItem, a prim path or as coordinates. If multiple prims are set, the target point will be the mean of their positions.

  • look_at_up_axis – Look-at up axis of the created prim.

  • focal_length – Physical focal length of the camera in units equal to 0.1 * world units.

  • focus_distance – Distance from the camera to the focus plane in world units.

  • f_stop – Lens aperture. Default 0.0 turns off focusing.

  • horizontal_aperture – Horizontal aperture in units equal to 0.1 * world units. Default simulates a 35mm spherical projection aperture.

  • horizontal_aperture_offset – Horizontal aperture offset in units equal to 0.1 * world units.

  • vertical_aperture_offset – Vertical aperture offset in units equal to 0.1 * world units.

  • clipping_range – (Near, Far) clipping distances of the camera in world units.

  • projection_type – Camera projection model. Select from [pinhole, fisheye_polynomial].

  • fisheye_nominal_width – Nominal width of fisheye lens model.

  • fisheye_nominal_height – Nominal height of fisheye lens model.

  • fisheye_optical_centre_x – Horizontal optical centre position of fisheye lens model.

  • fisheye_optical_centre_y – Vertical optical centre position of fisheye lens model.

  • fisheye_max_fov – Maximum field of view of fisheye lens model.

  • fisheye_polynomial_a – First component of fisheye polynomial (only valid for fisheye_polynomial projection type).

  • fisheye_polynomial_b – Second component of fisheye polynomial (only valid for fisheye_polynomial projection type).

  • fisheye_polynomial_c – Third component of fisheye polynomial (only valid for fisheye_polynomial projection type).

  • fisheye_polynomial_d – Fourth component of fisheye polynomial (only valid for fisheye_polynomial projection type).

  • fisheye_polynomial_e – Fifth component of fisheye polynomial (only valid for fisheye_polynomial projection type).

  • count – Number of objects to create.

  • parent – Optional parent prim path. The camera will be created as a child of this prim.

Example

>>> import omni.replicator.core as rep
>>> # Create camera
>>> camera = rep.create.camera(
...     position=rep.distribution.uniform((0,0,0), (100, 100, 100)),
...     rotation=(45, 45, 0),
...     focus_distance=rep.distribution.normal(400.0, 100),
...     f_stop=1.8,
... )
>>> # Attach camera to render product
>>> render_product = rep.create.render_product(camera, resolution=(1024, 1024))
omni.replicator.core.create.stereo_camera(stereo_baseline: Union[ReplicatorItem, float], position: Optional[Union[ReplicatorItem, float, Tuple[float]]] = None, rotation: Optional[Union[ReplicatorItem, float, Tuple[float]]] = None, look_at: Optional[Union[ReplicatorItem, str, Path, Tuple[float, float, float]]] = None, look_at_up_axis: Optional[Union[ReplicatorItem, Tuple[float]]] = None, focal_length: Union[ReplicatorItem, float] = 24.0, focus_distance: Union[ReplicatorItem, float] = 400.0, f_stop: Union[ReplicatorItem, float] = 0.0, horizontal_aperture: Union[ReplicatorItem, float] = 20.955, horizontal_aperture_offset: Union[ReplicatorItem, float] = 0.0, vertical_aperture_offset: Union[ReplicatorItem, float] = 0.0, clipping_range: Union[ReplicatorItem, Tuple[float, float]] = (1.0, 1000000.0), projection_type: Union[ReplicatorItem, str] = 'pinhole', fisheye_nominal_width: Union[ReplicatorItem, float] = 1936.0, fisheye_nominal_height: Union[ReplicatorItem, float] = 1216.0, fisheye_optical_centre_x: Union[ReplicatorItem, float] = 970.94244, fisheye_optical_centre_y: Union[ReplicatorItem, float] = 600.37482, fisheye_max_fov: Union[ReplicatorItem, float] = 200.0, fisheye_polynomial_a: Union[ReplicatorItem, float] = 0.0, fisheye_polynomial_b: Union[ReplicatorItem, float] = 0.00245, fisheye_polynomial_c: Union[ReplicatorItem, float] = 0.0, fisheye_polynomial_d: Union[ReplicatorItem, float] = 0.0, fisheye_polynomial_e: Union[ReplicatorItem, float] = 0.0, count: int = 1)
Create a stereo camera pair.
Args:

stereo_baseline: Distance between stereo camera pairs. position: XYZ coordinates in world space. If a single value is provided, all axes will be set to that value. rotation: Euler angles in degrees in XYZ order. If a single value is provided, all axes will be set to that value. look_at: Look-at target, specified either as a ReplicatorItem, a prim path or as coordinates. If multiple prims are set, the target point will be the mean of their positions. look_at_up_axis: Look-at up axis of the created prim. focal_length: Physical focal length of the camera in units equal to 0.1 * world units. focus_distance: Distance from the camera to the focus plane in world units. f_stop: Lens aperture. Default 0.0 turns off focusing. horizontal_aperture: Horizontal aperture in units equal to 0.1 * world units. Default simulates a 35mm spherical projection aperture. horizontal_aperture_offset: Horizontal aperture offset in units equal to 0.1 * world units. vertical_aperture_offset: Vertical aperture offset in units equal to 0.1 * world units. clipping_range: (Near, Far) clipping distances of the camera in world units. projection_type: Camera projection model. Select from [pinhole, fisheye_polynomial]. fisheye_nominal_width: Nominal width of fisheye lens model. fisheye_nominal_height: Nominal height of fisheye lens model. fisheye_optical_centre_x: Horizontal optical centre position of fisheye lens model. fisheye_optical_centre_y: Vertical optical centre position of fisheye lens model. fisheye_max_fov: Maximum field of view of fisheye lens model. fisheye_polynomial_a: First component of fisheye polynomial (only valid for fisheye_polynomial projection type). fisheye_polynomial_b: Second component of fisheye polynomial (only valid for fisheye_polynomial projection type). fisheye_polynomial_c: Third component of fisheye polynomial (only valid for fisheye_polynomial projection type). fisheye_polynomial_d: Fourth component of fisheye polynomial (only valid for fisheye_polynomial projection type). fisheye_polynomial_e: Fifth component of fisheye polynomial (only valid for fisheye_polynomial projection type). count: Number of objects to create.

Example

>>> import omni.replicator.core as rep
>>> # Create stereo camera
>>> stereo_camera_pair = rep.create.stereo_camera(
...     stereo_baseline=10,
...     position=(10, 10, 10),
...     rotation=(45, 45, 0),
...     focus_distance=rep.distribution.normal(400.0, 100),
...     f_stop=1.8,
... )
>>> # Attach camera to render product
>>> render_product = rep.create.render_product(stereo_camera_pair, resolution=(1024, 1024))
omni.replicator.core.create.cone(position: Union[ReplicatorItem, float, Tuple[float]] = None, scale: Union[ReplicatorItem, float, Tuple[float]] = None, pivot: Union[ReplicatorItem, Tuple[float]] = None, rotation: Union[ReplicatorItem, float, Tuple[float]] = None, look_at: Union[ReplicatorItem, str, Path, Tuple[float, float, float]] = None, look_at_up_axis: Union[ReplicatorItem, Tuple[float]] = None, semantics: List[Tuple[str, str]] = None, material: Union[ReplicatorItem, Prim] = None, visible: bool = True, as_mesh: bool = True, count: int = 1) Node

Create a cone

Parameters
  • position – XYZ coordinates in world space. If a single value is provided, all axes will be set to that value.

  • scale – Scaling factors for XYZ axes. If a single value is provided, all axes will be set to that value.

  • pivot – Pivot that sets the center point of translate and rotate operation. Pivot values are normalized between [-1, 1] for each axis based on the prim’s axis aligned extents.

  • rotation – Euler angles in degrees in XYZ order. If a single value is provided, all axes will be set to that value.

  • look_at – Look-at target, specified either as a ReplicatorItem, a prim path or as coordinates. If multiple prims are set, the target point will be the mean of their positions.

  • look_at_up_axis – Look-at up axis of the created prim.

  • semantics – List of semantic type-label pairs.

  • material – Material to attach to the cone.

  • visible – If false, the prim will be invisible. This is often useful when creating prims to use as bounds with other randomizers.

  • as_mesh – If false, create a Usd.Cone prim. If true, create a mesh.

  • count – Number of objects to create.

Example

>>> import omni.replicator.core as rep
>>> cone = rep.create.cone(
...     position=rep.distribution.uniform((0,0,0), (100, 100, 100)),
...     scale=2,
...     rotation=(45, 45, 0),
...     semantics=[("class", "cone")],
... )
omni.replicator.core.create.cube(position: Union[ReplicatorItem, float, Tuple[float]] = None, scale: Union[ReplicatorItem, float, Tuple[float]] = None, pivot: Union[ReplicatorItem, Tuple[float]] = None, rotation: Union[ReplicatorItem, float, Tuple[float]] = None, look_at: Union[ReplicatorItem, str, Path, Tuple[float, float, float]] = None, look_at_up_axis: Union[ReplicatorItem, Tuple[float]] = None, semantics: List[Tuple[str, str]] = None, material: Union[ReplicatorItem, Prim] = None, visible: bool = True, as_mesh: bool = True, count: int = 1) Node

Create a cube

Parameters
  • position – XYZ coordinates in world space. If a single value is provided, all axes will be set to that value.

  • scale – Scaling factors for XYZ axes. If a single value is provided, all axes will be set to that value.

  • pivot – Pivot that sets the center point of translate and rotate operation. Pivot values are normalized between [-1, 1] for each axis based on the prim’s axis aligned extents.

  • rotation – Euler angles in degrees in XYZ order. If a single value is provided, all axes will be set to that value.

  • look_at – Look-at target, specified either as a ReplicatorItem, a prim path or as coordinates. If multiple prims are set, the target point will be the mean of their positions.

  • look_at_up_axis – Look-at up axis of the created prim.

  • semantics – List of semantic type-label pairs.

  • material – Material to attach to the cube.

  • visible – If false, the prim will be invisible. This is often useful when creating prims to use as bounds with other randomizers.

  • as_mesh – If false, create a Usd.Cube prim. If true, create a mesh.

  • count – Number of objects to create.

Example

>>> import omni.replicator.core as rep
>>> cube = rep.create.cube(
...     position=rep.distribution.uniform((0,0,0), (100, 100, 100)),
...     scale=2,
...     rotation=(45, 45, 0),
...     semantics=[("class", "cube")],
... )
omni.replicator.core.create.cylinder(position: Union[ReplicatorItem, float, Tuple[float]] = None, scale: Union[ReplicatorItem, float, Tuple[float]] = None, pivot: Union[ReplicatorItem, Tuple[float]] = None, rotation: Union[ReplicatorItem, float, Tuple[float]] = None, look_at: Union[ReplicatorItem, str, Path, Tuple[float, float, float]] = None, look_at_up_axis: Union[ReplicatorItem, Tuple[float]] = None, semantics: List[Tuple[str, str]] = None, material: Union[ReplicatorItem, Prim] = None, visible: bool = True, as_mesh: bool = True, count: int = 1) Node

Create a cylinder

Parameters
  • position – XYZ coordinates in world space. If a single value is provided, all axes will be set to that value.

  • scale – Scaling factors for XYZ axes. If a single value is provided, all axes will be set to that value.

  • pivot – Pivot that sets the center point of translate and rotate operation. Pivot values are normalized between [-1, 1] for each axis based on the prim’s axis aligned extents.

  • rotation – Euler angles in degrees in XYZ order. If a single value is provided, all axes will be set to that value.

  • look_at – Look-at target, specified either as a ReplicatorItem, a prim path or as coordinates. If multiple prims are set, the target point will be the mean of their positions.

  • look_at_up_axis – Look-at up axis of the created prim.

  • semantics – List of semantic type-label pairs.

  • material – Material to attach to the cylinder.

  • visible – If false, the prim will be invisible. This is often useful when creating prims to use as bounds with other randomizers.

  • as_mesh – If false, create a Usd.Cylinder prim. If true, create a mesh.

  • count – Number of objects to create.

Example

>>> import omni.replicator.core as rep
>>> cylinder = rep.create.cylinder(
...     position=rep.distribution.uniform((0,0,0), (100, 100, 100)),
...     scale=2,
...     rotation=(45, 45, 0),
...     semantics=[("class", "cylinder")],
... )
omni.replicator.core.create.disk(position: Union[ReplicatorItem, float, Tuple[float]] = None, scale: Union[ReplicatorItem, float, Tuple[float]] = None, pivot: Union[ReplicatorItem, Tuple[float]] = None, rotation: Union[ReplicatorItem, float, Tuple[float]] = None, look_at: Union[ReplicatorItem, str, Path, Tuple[float, float, float]] = None, look_at_up_axis: Union[ReplicatorItem, Tuple[float]] = None, semantics: List[Tuple[str, str]] = None, material: Union[ReplicatorItem, Prim] = None, visible: bool = True, count: int = 1) Node

Create a disk

Parameters
  • position – XYZ coordinates in world space. If a single value is provided, all axes will be set to that value.

  • scale – Scaling factors for XYZ axes. If a single value is provided, all axes will be set to that value.

  • pivot – Pivot that sets the center point of translate and rotate operation. Pivot values are normalized between [-1, 1] for each axis based on the prim’s axis aligned extents.

  • rotation – Euler angles in degrees in XYZ order. If a single value is provided, all axes will be set to that value.

  • look_at – Look-at target, specified either as a ReplicatorItem, a prim path or as coordinates. If multiple prims are set, the target point will be the mean of their positions.

  • look_at_up_axis – Look-at up axis of the created prim.

  • semantics – List of semantic type-label pairs.

  • material – Material to attach to the disk.

  • visible – If false, the prim will be invisible. This is often useful when creating prims to use as bounds with other randomizers.

  • count – Number of objects to create.

Example

>>> import omni.replicator.core as rep
>>> disk = rep.create.disk(
...     position=rep.distribution.uniform((0,0,0), (100, 100, 100)),
...     scale=2,
...     rotation=(45, 45, 0),
...     semantics=[("class", "disk")],
... )
omni.replicator.core.create.from_dir(dir_path: str, recursive: bool = False, path_filter: Optional[str] = None, semantics: Optional[List[Tuple[str, str]]] = None) Node

Create a group of assets from the USD files found in dir_path

Parameters
  • dir_path – The root path to search from.

  • recursive – If True, search through sub-folders.

  • path_filter – A Regular Expression (RegEx) string to filter paths with.

  • semantics – List of semantic type-label pairs.

Example

>>> import omni.replicator.core as rep
>>> asset_path = rep.example.ASSETS_DIR
>>> asset = rep.create.from_dir(asset_path, path_filter="rocket")
omni.replicator.core.create.from_usd(usd: str, semantics: List[Tuple[str, str]] = None, count: int = 1) Node

Reference a USD into the current USD stage.

Parameters
  • usd – Path to a usd file (*.usd, *.usdc, *.usda)

  • semantics – List of semantic type-label pairs.

Example

>>> import omni.replicator.core as rep
>>> usd_path = rep.example.ASSETS[0]
>>> asset = rep.create.from_usd(usd_path, semantics=[("class", "example")])
omni.replicator.core.create.group(items: List[Union[ReplicatorItem, str, Path]], semantics: List[Tuple[str, str]] = None) Node

Group assets into a common node. Grouping assets makes it easier and faster to apply randomizations to multiple assets simultaneously.

Parameters
  • items – Assets to be grouped together.

  • semantics – List of semantic type-label pairs.

Example

>>> import omni.replicator.core as rep
>>> cones = [rep.create.cone() for _ in range(100)]
>>> group = rep.create.group(cones, semantics=[("class", "cone")])
omni.replicator.core.create.light(position: Union[ReplicatorItem, float, Tuple[float]] = None, scale: Union[ReplicatorItem, float, Tuple[float]] = None, rotation: Union[ReplicatorItem, float, Tuple[float]] = None, look_at: Union[ReplicatorItem, str, Path, Tuple[float, float, float]] = None, look_at_up_axis: Union[ReplicatorItem, Tuple[float]] = None, light_type: str = 'Distant', color: Union[ReplicatorItem, Tuple[float, float, float]] = (1.0, 1.0, 1.0), intensity: Union[ReplicatorItem, float] = 1000.0, exposure: Union[ReplicatorItem, float] = None, temperature: Union[ReplicatorItem, float] = 6500, texture: Union[ReplicatorItem, str] = None, count: int = 1) Node

Create a light

Parameters
  • position – XYZ coordinates in world space. If a single value is provided, all axes will be set to that value. Ignored for dome and distant light types.

  • scale – Scaling factors for XYZ axes. If a single value is provided, all axes will be set to that value. Ignored for dome and distant light types.

  • rotation – Euler angles in degrees in XYZ order. If a single value is provided, all axes will be set to that value.

  • look_at – Look-at target, specified either as a ReplicatorItem, a prim path or as coordinates. If multiple prims are set, the target point will be the mean of their positions.

  • look_at_up_axis – Look-at up axis of the created prim.

  • light_type – Light type. Select from [“cylinder”, “disk”, “distant”, “dome”, “rect”, “sphere”]

  • color – Light color in RGB colorspace.

  • intensity – Light intensity. Scales the power of the light linearly.

  • exposure – Scales the power of the light exponentially as a power of 2. The result is multiplied with intensity.

  • temperature – Color temperature in degrees Kelvin indicating the white point. Lower values are warmer, higher values are cooler. Valid range [1000, 10000].

  • texture – Image texture to use for dome light such as an HDR (High Dynamic Range) intended for IBL (Image Based Lighting). Ignored for other light types.

  • count – Number of objects to create.

Examples

>>> import omni.replicator.core as rep
>>> distance_light = rep.create.light(
... rotation=rep.distribution.uniform((0,-180,-180), (0,180,180)),
... intensity=rep.distribution.normal(10000, 1000),
... temperature=rep.distribution.normal(6500, 1000),
... light_type="distant")
>>> dome_light = rep.create.light(
... rotation=rep.distribution.uniform((0,-180,-180), (0,180,180)),
... texture=rep.distribution.choice(rep.example.TEXTURES),
... light_type="dome")
omni.replicator.core.create.material_omnipbr(diffuse: Tuple[float] = None, diffuse_texture: str = None, roughness: float = None, roughness_texture: str = None, metallic: float = None, metallic_texture: str = None, specular: float = None, emissive_color: Tuple[float] = None, emissive_texture: str = None, emissive_intensity: float = 0.0, project_uvw: bool = False, semantics: List[Tuple[str, str]] = None, count: int = 1)

Create an OmniPBR Material

Parameters
  • diffuse – Diffuse/albedo color in RGB colorspace

  • diffuse_texture – Path to diffuse texture

  • roughness – Material roughness in the range [0, 1]

  • roughness_texture – Path to roughness texture

  • metallic – Material metallic value in the range [0, 1]. Typically, metallic is assigned either 0.0 or 1.0

  • metallic_texture – Path to metallic texture

  • specular – Intensity of specular reflections in the range [0, 1]

  • emissive_color – Color of emissive light emanating from material in RGB colorspace

  • emissive_texture – Path to emissive texture

  • emissive_intensity – Emissive intensity of the material. Setting to 0.0 (default) disables emission.

  • project_uvw – When True, UV coordinates will be generated by projecting them from a coordinate system.

  • semantics – Assign semantics to material

  • count – Number of objects to create.

Example

>>> import omni.replicator.core as rep
>>> mat1 = rep.create.material_omnipbr(
...    diffuse=rep.distribution.uniform((0, 0, 0), (1, 1, 1)),
...    roughness=rep.distribution.uniform(0, 1),
...    metallic=rep.distribution.choice([0, 1]),
...    emissive_color=rep.distribution.uniform((0, 0, 0.5), (0, 0, 1)),
...    emissive_intensity=rep.distribution.uniform(0, 1000),
... )
>>> mat2 = rep.create.material_omnipbr(
...    diffuse_texture=rep.distribution.choice(rep.example.TEXTURES),
...    roughness_texture=rep.distribution.choice(rep.example.TEXTURES),
...    metallic_texture=rep.distribution.choice(rep.example.TEXTURES),
...    emissive_texture=rep.distribution.choice(rep.example.TEXTURES),
...    emissive_intensity=rep.distribution.uniform(0, 1000),
... )
>>> cone = rep.create.cone(material=mat1)
>>> torus = rep.create.torus(material=mat2)
omni.replicator.core.create.plane(position: Union[ReplicatorItem, float, Tuple[float]] = None, scale: Union[ReplicatorItem, float, Tuple[float]] = None, pivot: Union[ReplicatorItem, Tuple[float]] = None, rotation: Union[ReplicatorItem, float, Tuple[float]] = None, look_at: Union[ReplicatorItem, str, Path, Tuple[float, float, float]] = None, look_at_up_axis: Union[ReplicatorItem, Tuple[float]] = None, semantics: List[Tuple[str, str]] = None, material: Union[ReplicatorItem, Prim] = None, visible: bool = True, count: int = 1) Node

Create a plane

Parameters
  • position – XYZ coordinates in world space. If a single value is provided, all axes will be set to that value.

  • scale – Scaling factors for XYZ axes. If a single value is provided, all axes will be set to that value.

  • pivot – Pivot that sets the center point of translate and rotate operation. Pivot values are normalized between [-1, 1] for each axis based on the prim’s axis aligned extents.

  • rotation – Euler angles in degrees in XYZ order. If a single value is provided, all axes will be set to that value.

  • look_at – Look-at target, specified either as a ReplicatorItem, a prim path or as coordinates. If multiple prims are set, the target point will be the mean of their positions.

  • look_at_up_axis – Look-at up axis of the created prim.

  • semantics – List of semantic type-label pairs.

  • material – Material to attach to the plane.

  • visible – If false, the prim will be invisible. This is often useful when creating prims to use as bounds with other randomizers.

  • count – Number of objects to create.

Example

>>> import omni.replicator.core as rep
>>> plane = rep.create.plane(
...     position=rep.distribution.uniform((0,0,0), (100, 100, 100)),
...     scale=2,
...     rotation=(45, 45, 0),
...     semantics=[("class", "plane")],
... )
omni.replicator.core.create.register(fn: Callable[[...], Union[ReplicatorItem, Node]], override: bool = True) None

Register a new function under omni.replicator.core.create. Extend the default capabilities of omni.replicator.core.create by registering new functionality. New functions must return a ReplicatorItem or an OmniGraph node.

Parameters
  • fn – A function that returns a ReplicatorItem or an OmniGraph node.

  • override – If True, will override existing functions of the same name. If false, an error is raised.

Example

>>> import omni.replicator.core as rep
>>> def light_cluster(num_lights: int = 10):
...     lights = rep.create.light(
...         light_type="sphere",
...         count=num_lights,
...         position=rep.distribution.uniform((-500, -500, -500), (500, 500, 500)),
...         intensity=rep.distribution.uniform(10000, 20000),
...         temperature=rep.distribution.uniform(1000, 10000),
...     )
...     return lights
>>> rep.create.register(light_cluster)
>>> lights = rep.create.light_cluster(50)
omni.replicator.core.create.render_product(camera: Union[ReplicatorItem, str, List[str], Path, List[Path]], resolution: Tuple[int, int]) Node

Create a render product A RenderProduct describes images or other file-like artifacts produced by a render, such as rgb (LdrColor), normals, depth, etc.

Parameters
  • camera – The camera to attach to the render product.

  • resolution – (width, height) resolution of the render product

Example

>>> import omni.replicator.core as rep
>>> render_product = rep.create.render_product(rep.create.camera(), resolution=(1024, 1024))
omni.replicator.core.create.sphere(position: Union[ReplicatorItem, float, Tuple[float]] = None, scale: Union[ReplicatorItem, float, Tuple[float]] = None, pivot: Union[ReplicatorItem, Tuple[float]] = None, rotation: Union[ReplicatorItem, float, Tuple[float]] = None, look_at: Union[ReplicatorItem, str, Path, Tuple[float, float, float]] = None, look_at_up_axis: Union[ReplicatorItem, Tuple[float]] = None, semantics: List[Tuple[str, str]] = None, material: Union[ReplicatorItem, Prim] = None, visible: bool = True, as_mesh: bool = True, count: int = 1) Node

Create a sphere

Parameters
  • position – XYZ coordinates in world space. If a single value is provided, all axes will be set to that value.

  • scale – Scaling factors for XYZ axes. If a single value is provided, all axes will be set to that value.

  • pivot – Pivot that sets the center point of translate and rotate operation. Pivot values are normalized between [-1, 1] for each axis based on the prim’s axis aligned extents.

  • rotation – Euler angles in degrees in XYZ order. If a single value is provided, all axes will be set to that value.

  • look_at – Look-at target, specified either as a ReplicatorItem, a prim path or as coordinates. If multiple prims are set, the target point will be the mean of their positions.

  • look_at_up_axis – Look-at up axis of the created prim.

  • semantics – List of semantic type-label pairs.

  • material – Material to attach to the sphere.

  • visible – If false, the prim will be invisible. This is often useful when creating prims to use as bounds with other randomizers.

  • as_mesh – If false, create a Usd.Sphere prim. If true, create a mesh.

  • count – Number of objects to create.

Example

>>> import omni.replicator.core as rep
>>> sphere = rep.create.sphere(
...     position=rep.distribution.uniform((0,0,0), (100, 100, 100)),
...     scale=2,
...     rotation=(45, 45, 0),
...     semantics=[("class", "sphere")],
... )
omni.replicator.core.create.torus(position: Union[ReplicatorItem, float, Tuple[float]] = None, scale: Union[ReplicatorItem, float, Tuple[float]] = None, pivot: Union[ReplicatorItem, Tuple[float]] = None, rotation: Union[ReplicatorItem, float, Tuple[float]] = None, look_at: Union[ReplicatorItem, str, Path, Tuple[float, float, float]] = None, look_at_up_axis: Union[ReplicatorItem, Tuple[float]] = None, semantics: List[Tuple[str, str]] = None, material: Union[ReplicatorItem, Prim] = None, visible: bool = True, count: int = 1) Node

Create a torus

Parameters
  • position – XYZ coordinates in world space. If a single value is provided, all axes will be set to that value.

  • scale – Scaling factors for XYZ axes. If a single value is provided, all axes will be set to that value.

  • pivot – Pivot that sets the center point of translate and rotate operation. Pivot values are normalized between [-1, 1] for each axis based on the prim’s axis aligned extents.

  • rotation – Euler angles in degrees in XYZ order. If a single value is provided, all axes will be set to that value.

  • look_at – Look-at target, specified either as a ReplicatorItem, a prim path or as coordinates. If multiple prims are set, the target point will be the mean of their positions.

  • look_at_up_axis – Look-at up axis of the created prim.

  • semantics – List of semantic type-label pairs.

  • material – Material to attach to the torus.

  • visible – If false, the prim will be invisible. This is often useful when creating prims to use as bounds with other randomizers.

  • count – Number of objects to create.

Example

>>> import omni.replicator.core as rep
>>> torus = rep.create.torus(
...     position=rep.distribution.uniform((0,0,0), (100, 100, 100)),
...     scale=2,
...     rotation=(45, 45, 0),
...     semantics=[("class", "torus")],
... )

Get

omni.replicator.core.get.prims(path_pattern: str = None, path_pattern_exclusion: str = None, prim_types: Union[str, List[str]] = None, prim_types_exclusion: Union[str, List[str]] = None, semantics: Union[List[Tuple[str, str]], Tuple[str, str]] = None, semantics_exclusion: Union[List[Tuple[str, str]], Tuple[str, str]] = None, cache_result: bool = True)

Get prims based on specified constraints.

Search the stage for stage paths with matches to the specified constraints.

Parameters
  • path_pattern – The RegEx (Regular Expression) path pattern to match.

  • path_pattern_exclusion – The RegEx (Regular Expression) path pattern to ignore.

  • prim_types – List of prim types to include

  • prim_types_exclusion – List of prim types to ignore

  • semantics – Semantic type-value pairs of semantics to include

  • semantics_exclusion – Semantic type-value pairs of semantics to ignore

  • cache_result – Run get prims a single time, then return the cached result

omni.replicator.core.get.register(fn, override=True)

Register a new function under omni.replicator.core.get. Extend the default capabilities of omni.replicator.core.get by registering new functionality. New functions must return a ReplicatorItem or an OmniGraph node.

Parameters
  • fn – A function that returns a ReplicatorItem or an OmniGraph node.

  • override – If True, will override existing functions of the same name. If false, an error is raised.

Distribution

omni.replicator.core.distribution.choice(choices: List[str], weights: List[float] = None, num_samples: Union[ReplicatorItem, int] = 1, seed: Optional[int] = None, with_replacements: bool = True, name: Optional[str] = None)

Provides sampling from a list of values

Parameters
  • choices – Values in the distribution to choose from.

  • weights – Matching list of weights for each choice.

  • num_samples – The number of times to sample.

  • seed (optional) – A seed to use for the sampling.

  • with_replacements – If True, allow re-sampling the same element. If False, each element can only be sampled once. Note that in this case, the size of the elements being sampled must be larger than the sampling size. Default is True.

  • name (optional) – A name for the given distribution. Named distributions will have their values available to the Writer.

omni.replicator.core.distribution.combine(distributions: List[Union[ReplicatorItem, Tuple[ReplicatorItem]]], name: Optional[str] = None)

Combine input from different distributions.

Parameters
  • distributions – List of Replicator distribution nodes or numbers.

  • name (optional) – A name for the given distribution. Named distributions will have their values available to the Writer.

omni.replicator.core.distribution.log_uniform(lower: Tuple, upper: Tuple, num_samples: int = 1, seed: Optional[int] = None, name: Optional[str] = None)

Provides sampling with a log uniform distribution

Parameters
  • lower – Lower end of the distribution.

  • upper – Upper end of the distribution.

  • num_samples – The number of times to sample.

  • seed (optional) – A seed to use for the sampling.

  • name (optional) – A name for the given distribution. Named distributions will have their values available to the Writer.

omni.replicator.core.distribution.normal(mean: Tuple, std: Tuple, num_samples: int = 1, seed: Optional[int] = None, name: Optional[str] = None)

Provides sampling with a normal distribution

Parameters
  • mean – Average value for the distribution.

  • std – Standard deviation value for the distribution.

  • num_samples – The number of times to sample.

  • seed (optional) – A seed to use for the sampling.

  • name (optional) – A name for the given distribution. Named distributions will have their values available to the Writer.

omni.replicator.core.distribution.register(fn: Callable[[...], Union[ReplicatorItem, Node]], override: bool = True) None

Register a new function under omni.replicator.core.distribution. Extend the default capabilities of omni.replicator.core.distribution by registering new functionality. New functions must return a ReplicatorItem or an OmniGraph node.

Parameters
  • fn – A function that returns a ReplicatorItem or an OmniGraph node.

  • override – If True, will override existing functions of the same name. If false, an error is raised.

omni.replicator.core.distribution.sequence(items: list, name: Optional[str] = None)

Provides sampling sequentially

Parameters
  • items – Ordered list of items to sample sequentially.

  • name (optional) – A name for the given distribution. Named distributions will have their values available to the Writer.

Example

>>> import omni.replicator.core as rep
>>> cube = rep.create.cube(count=1)
>>> with cube:
...     rep.modify.pose(position=rep.distribution.sequence([(0.0, 0.0, 200.0), (0.0, 200.0, 0.0), (200.0, 0.0, 0.0)]))
omni.replicator.core.distribution.sequence
omni.replicator.core.distribution.uniform(lower: Tuple, upper: Tuple, num_samples: int = 1, seed: Optional[int] = None, name: Optional[str] = None)

Provides sampling with a uniform distribution

Parameters
  • lower – Lower end of the distribution.

  • upper – Upper end of the distribution.

  • num_samples – The number of times to sample.

  • seed (optional) – A seed to use for the sampling.

  • name (optional) – A name for the given distribution. Named distributions will have their values available to the Writer.

Modify

omni.replicator.core.modify.attribute(name: str, value: Union[Any, ReplicatorItem], attribute_type: str = None, input_prims: Union[ReplicatorItem, List[str]] = None) Node

Modify the attribute of the prims specified in input_prims.

Parameters
  • name – The name of the attribute to modify.

  • value – The value to set the attribute to.

  • attribute_type – The data type of the attribute. This parameter is required if the attribute specified does not already exist and must be created.

  • input_prims – The prims to be modified. If using with syntax, this argument can be omitted.

Example

>>> import omni.replicator.core as rep
>>> sphere = rep.create.sphere(as_mesh=False)
>>> with sphere:
...     rep.modify.attribute("radius", rep.distribution.uniform(1, 5))
omni.replicator.core.modify.attribute
omni.replicator.core.modify.pose(position: Union[ReplicatorItem, float, Tuple[float]] = None, rotation: Union[ReplicatorItem, float, Tuple[float]] = None, rotation_order: str = 'XYZ', scale: Union[ReplicatorItem, float, Tuple[float]] = None, size: Union[ReplicatorItem, float, Tuple[float]] = None, pivot: Union[ReplicatorItem, Tuple[float]] = None, look_at: Union[ReplicatorItem, List[Union[str, Path]]] = None, look_at_up_axis: Union[str, Tuple[float, float, float]] = None, input_prims: Union[ReplicatorItem, List[str]] = None) Node

Modify the position, rotation, scale, and/or look-at target of the prims specified in input_prims.

NOTE: rotation and look_at cannot both be specified.

NOTE: size and scale cannot both be specified.

NOTE: size is converted to scale based on the prim’s current axis-aligned bounding box size. If a scale is already applied, it might not be able to reflect the true size of the prim.

Parameters
  • position – XYZ coordinates in world space.

  • rotation – Rotation in degrees for the axes specified in rotation_order

  • rotation_order – Order of rotation. Select from [XYZ, XZY, YXZ, YZX, ZXY, ZYX]

  • scale – Scale factor for each of XYZ axes.

  • size – Desired size of the input prims. Each input prim is scaled to match the specified size extents in each of the XYZ axes.

  • pivot – Pivot that sets the center point of translate and rotate operation.

  • look_at – The look at target to orient towards. If multiple prims are set, the target point will be the mean of their positions.

  • look_at_up_axis – The up axis used in look_at function

  • input_prims – The prims to be modified. If using with syntax, this argument can be omitted.

Example

>>> import omni.replicator.core as rep
>>> with rep.create.cube():
...     rep.modify.pose(position=rep.distribution.uniform((0, 0, 0), (100, 100, 100)),
...                     scale=rep.distribution.uniform(0.1, 10),
...                     look_at=(0, 0, 0))
omni.replicator.core.modify.pose
omni.replicator.core.modify.pose_camera_relative(camera: Union[ReplicatorItem, List[str]], render_product: ReplicatorItem, distance: float, horizontal_location: float = 0, vertical_location: float = 0, input_prims=None)

Modify the positions of the prime relative to a camera.

Parameters
  • camera – Camera that the prim is relative to.

  • horizontal_location – Horizontal location in the camera space, which is in the range (-1, 1).

  • vertical_location – Vertical location in the camera space, which is in the range (-1, 1).

  • distance – Distance from the prim to the camera.

  • input_prims – The prims to be modified. If using with syntax, this argument can be omitted.

Example

>>> import omni.replicator.core as rep
>>> camera = rep.create.camera()
>>> render_product = rep.create.render_product(camera, (1024, 512))
>>> with rep.create.cube():
...     rep.modify.pose_camera_relative(camera, render_product, distance=500, horizontal_location=0, vertical_location=0)
omni.replicator.core.modify.pose_camera_relative
omni.replicator.core.modify.register(fn, override=True)

Register a new function under omni.replicator.core.modify. Extend the default capabilities of omni.replicator.core.modify by registering new functionality. New functions must return a ReplicatorItem or an OmniGraph node.

Parameters
  • fn – A function that returns a ReplicatorItem or an OmniGraph node.

  • override – If True, will override existing functions of the same name. If false, an error is raised.

omni.replicator.core.modify.semantics(semantics: List[Tuple[str, str]] = None, input_prims: Union[ReplicatorItem, List[str]] = None) Node

Modify the orientation of the prims specified in input_prims to look at the specified target.

Parameters
  • target – The target to orient towards. If multiple prims are set, the target point will be the mean of their positions.

  • input_prims – The prims to be modified. If using with syntax, this argument can be omitted.

Example

>>> import omni.replicator.core as rep
>>> with rep.create.sphere():
...     rep.modify.semantics([("class", "sphere")])
omni.replicator.core.modify.semantics
omni.replicator.core.modify.visibility(value: Union[ReplicatorItem, List[bool]] = None, input_prims: Union[ReplicatorItem, List[str]] = None) Node

Randomizer

omni.replicator.core.randomizer.color(colors: Union[ReplicatorItem, List[Tuple[float]]], per_sub_mesh: bool = False, seed: int = None, input_prims: Union[ReplicatorItem, List[str]] = None) Node

Randomize colors Creates and binds an OmniPBR material to each prim in input_prims and modifies colors.

Parameters
  • textures – List of texture paths, or a ReplicatorItem that outputs a list of texture paths. The number of textures must correspond with the number of input_prims.

  • per_sub_mesh – If True, bind a material to each mesh and geom_subset. If False, a material is bound only to the specified prim.

  • input_prims – List of input_prims. If constructing using with structure, set to None to bind input_prims to the current context.

Example

>>> import omni.replicator.core as rep
>>> cones = rep.create.cone(position=rep.distribution.uniform((-100,-100,-100),(100,100,100)), count=100)
>>> with cones:
...     rep.randomizer.color(colors=rep.distribution.uniform((0, 0, 0), (1, 1, 1)))
omni.replicator.core.randomizer.color
omni.replicator.core.randomizer.instantiate(paths: Union[ReplicatorItem, List[str]], size: Union[ReplicatorItem, int], weights: List[float] = None, mode: str = 'scene_instance', with_replacements=True, seed: int = None, use_cache: bool = True)

Sample size number of prims from the paths provided.

Parameters
  • paths – The list of USD paths pointing to the assets to sample from.

  • size – The number of samples to sample.

  • weights – The weights to use for sampling. If provided, the length of weights must match the length of paths. If omitted, uniform sampling will be used.

  • mode – The instantiation mode. Choose from [scene_instance, point_instance, reference]. Defaults to scene_instance. Scene Instance creates a prototype in the cache, and new instances reference the prototype. Point Instances are best suited for situations requiring a very large number of samples, but only pose attributes can be modified per instance. Reference mode is used for asset references that need to be modified (WARNING: this mode has know material loading issue.).

  • with_replacements – When False, avoids duplicates when sampling. Default True.

  • seed – Seed to use as initialization for the pseudo-random number generator. If not specified, the global seed will be used.

  • use_cache – If True, cache the assets in paths to speed up randomization. Set to False if the size of the population is too large to be cached. Default: True.

Example

>>> import omni.replicator.core as rep
>>> usds = rep.utils.get_usd_files(rep.example.ASSETS_DIR)
>>> with rep.randomizer.instantiate(usds, size=100):
...     rep.modify.pose(position=rep.distribution.uniform((-50,-50,-50),(50,50,50)))
omni.replicator.core.modify.pose
omni.replicator.core.randomizer.materials(materials: Union[ReplicatorItem, List[str]], seed: int = None, input_prims=None)

Sample materials from provided materials and bind to the input_prims.

Note that binding materials is a relatively expensive operation. It is generally more efficient to modify materials already bound to prims.

Parameters
  • materials – The list of materials to sample from and bind to the input prims. The materials can be prim paths, MDL paths or a ReplicatorItem.

  • seed – Seed to use as initialization for the pseudo-random number generator. If not specified, the global seed will be used.

  • input_prims – The prims to be modified. If using with syntax, this argument can be omitted.

Example

>>> import omni.replicator.core as rep
>>> mats = rep.create.material_omnipbr(diffuse=rep.distribution.uniform((0,0,0), (1,1,1)), count=100)
>>> spheres = rep.create.sphere(
...     scale=0.2,
...     position=rep.distribution.uniform((-100,-100,-100), (100,100,100)),
...     count=100
... )
>>> with spheres:
...     rep.randomizer.materials(mats)
omni.replicator.core.randomizer.materials
omni.replicator.core.randomizer.register(fn: Callable[[...], Union[ReplicatorItem, Node]], override: bool = True) None

Register a new function under omni.replicator.core.randomizer. Extend the default capabilities of omni.replicator.core.randomizer by registering new functionality. New functions must return a ReplicatorItem or an OmniGraph node.

Parameters
  • fn – A function that returns a ReplicatorItem or an OmniGraph node.

  • override – If True, will override existing functions of the same name. If false, an error is raised.

Example

>>> import omni.replicator.core as rep
>>> def scatter_points(points):
...     return rep.modify.pose(position=rep.distribution.choice(points))
>>> rep.randomizer.register(scatter_points)
>>> with rep.create.cone():
...     rep.randomizer.scatter_points([(0, 0, 0), (0, 0, 100), (0, 0, 200)])
omni.replicator.core.randomizer.scatter_points
omni.replicator.core.randomizer.rotation(min_angle: Tuple[float, float, float] = (- 180.0, - 180.0, - 180.0), max_angle: Tuple[float, float, float] = (180.0, 180.0, 180.0), seed: int = None, input_prims: Union[ReplicatorItem, List[str]] = None)

Randomize the rotation of the input prims

This randomizer produces a truly uniformly distributed rotations to the input prims. In contrast, rotations are not truly uniformly distributed when simply sampling uniformly for each rotation axis.

Parameters
  • min_angle – Minimum value for Euler angles in XYZ form (degrees)

  • max_angle – Maximum value for Euler angles in XYZ form (degrees)

  • seed – Seed to use as initialization for the pseudo-random number generator. If not specified, the global seed will be used.

  • input_prims – The prims to be modified. If using with syntax, this argument can be omitted.

Example

>>> import omni.replicator.core as rep
>>> cubes = rep.create.cube(position=rep.distribution.uniform((-100,-100,-100),(100,100,100)), count=100)
>>> with cubes:
...     rep.randomizer.rotation()
omni.replicator.core.randomizer.rotation
omni.replicator.core.randomizer.scatter_2d(surface_prims: Union[ReplicatorItem, List[str]], seed: int = None, offset: int = 0, check_for_collisions: bool = False, input_prims: Union[ReplicatorItem, List[str]] = None)

Scatter input prims across the surface of the specified surface prims.

Parameters
  • surface_prims – The prims across which to scatter the input prims. These can be meshes or GeomSubsets which specify a subset of a mesh’s polygons on which to scatter.

  • seed – Seed to use as initialization for the pseudo-random number generator. If not specified, the global seed will be used.

  • offset – The distance the prims should be offset along the normal of the surface of the mesh.

  • check_for_collisions – Whether the scatter operation should ensure that objects are not intersecting.

  • input_prims – The prims to be modified. If using with syntax, this argument can be omitted.

Example

>>> import omni.replicator.core as rep
>>> spheres = rep.create.sphere(count=100)
>>> surface_prim = rep.create.torus(scale=20, visible=False)
>>> with spheres:
...     rep.randomizer.scatter_2d(surface_prim)
omni.replicator.core.randomizer.scatter_2d
omni.replicator.core.randomizer.scatter_3d(volume_prims: Union[ReplicatorItem, List[str]], resolution_scaling: float = 1.0, check_for_collisions: bool = False, seed: int = None, input_prims: Union[ReplicatorItem, List[str]] = None)

Scatter input prims within the bounds of the specified volume prims.

Parameters
  • volume_prims – The prims within which to scatter the input prims. Currently, only meshes are supported.

  • resolution_scaling – The scale factor that should be applied to the resolution of the voxelgrid. Higher values

  • voxels (will ensure more fine-grained) –

  • performance. (but will come at the cost of) –

  • check_for_collisions – Whether the scatter operation should ensure that objects are not intersecting.

  • seed – Seed to use as initialization for the pseudo-random number generator. If not specified, the global seed will be used.

  • input_prims – The prims to be modified. If using with syntax, this argument can be omitted.

Example

>>> import omni.replicator.core as rep
>>> spheres = rep.create.sphere(count=100)
>>> volume_prim = rep.create.torus(scale=20, visible=False)
>>> with spheres:
...     rep.randomizer.scatter_3d(volume_prim)
omni.replicator.core.randomizer.scatter_3d
omni.replicator.core.randomizer.texture(textures: Union[ReplicatorItem, List[str]], texture_scale: Union[ReplicatorItem, List[Tuple[float, float]]] = None, texture_rotate: Union[ReplicatorItem, List[int]] = None, per_sub_mesh: bool = False, project_uvw: bool = False, seed: int = None, input_prims: Union[ReplicatorItem, List[str]] = None) Node

Randomize texture Creates and binds an OmniPBR material to each prim in input_prims and modifies textures.

Parameters
  • textures – List of texture paths, or a ReplicatorItem that outputs a list of texture paths. If a list of texture paths is provided, they will be sampled uniformly using the global seed.

  • texture_scale – List of texture scales in (X, Y) represented by positive floats. Larger values will make the texture appear smaller on the asset.

  • texture_rotate – Rotation in degrees of the texture.

  • per_sub_mesh – If True, bind a material to each mesh and geom_subset. If False, a material is bound only to the specified prim.

  • project_uvw – When True, UV coordinates will be generated by projecting them from a coordinate system.

  • seed – Seed to use as initialization for the pseudo-random number generator. If not specified, the global seed will be used.

  • input_prims – List of input_prims. If constructing using with structure, set to None to bind input_prims to the current context.

Example

>>> import omni.replicator.core as rep
>>> with rep.create.cone(position=rep.distribution.uniform((-100,-100,-100),(100,100,100)), count=100):
...     rep.randomizer.texture(textures=rep.example.TEXTURES, texture_scale=[(0.5, 0.5)], texture_rotate=[45])
omni.replicator.core.randomizer.texture

Physics

omni.replicator.core.physics.collider(approximation_shape: str = 'convexHull', input_prims: Optional[Union[ReplicatorItem, List]] = None)

Applies the Physx Collision API to the prims specified in input_prims.

Parameters
  • approximation_shape – The approximation used in the collider (by default, convex hull). Other approximations include “convexDecomposition”, “boundingSphere”, “boundingCube”, “meshSimplification”, and “none”. “none” will just use default mesh geometry.

  • input_prims – The prims to be modified. If using with syntax, this argument can be omitted.

Example

>>> import omni.replicator.core as rep
>>> with rep.create.cube():
...     rep.physics.collider()
omni.replicator.core.physics.drive_properties(stiffness: Union[ReplicatorItem, float] = 0.0, damping: Union[ReplicatorItem, float] = 0.0, input_prims: Union[ReplicatorItem, List] = None)
Applies the Drive API to the prims specified in input_prims, if necessary. Prims must be either revolute or

prismatic joints. For D6 joint randomization, please refer to omni.replicator.core.modify.attribute and provide the exact attribute name of the drive parameter to be randomized.

Parameters
  • stiffness – The stiffness of the drive (unitless).

  • damping – The damping of the drive (unitless).

  • input_prims – The prims to be modified. If using with syntax, this argument can be omitted.

omni.replicator.core.physics.mass(mass: Optional[float] = None, density: Optional[float] = None, center_of_mass: Optional[List] = None, diagonal_inertia: Optional[List] = None, principal_axes: Optional[List] = None, input_prims: Union[ReplicatorItem, List] = None)
Applies the Physx Mass API to the prims specified in input_prims, if necessary. This function sets up randomization

parameters for various mass-related properties in the mass API.

Parameters
  • mass – The mass of the prim. By default mass is derived from the volume of the collision geometry multiplied by a density.

  • density – The density of the prim.

  • center_of_mass – Center of the mass of the prim in local coordinates.

  • diagonal_inertia – Constructs a diagonalized inertia tensor along the principal axes.

  • principal_axes – A quaternion (wxyz) representing the orientation of the principal axes in the local coordinate frame.

  • input_prims – The prims to be modified. If using with syntax, this argument can be omitted.

Example

>>> import omni.replicator.core as rep
>>> with rep.create.cube():
...     rep.physics.mass(mass=rep.distribution.uniform(1.0, 50.0))
omni.replicator.core.physics.mass
omni.replicator.core.physics.physics_material(static_friction: Union[ReplicatorItem, float] = None, dynamic_friction: Union[ReplicatorItem, float] = None, restitution: Union[ReplicatorItem, float] = None, input_prims: Union[ReplicatorItem, List] = None)
If input prim is a material, the physics material API will be applied if necessary. Otherwise, if the prim has a

bound material, then randomizations will be made on this material (where once again, with the physics material API being bound if necessary). If the prim does not have a bound material, then a physics material will be created at <prim_path>/PhysicsMaterial and bound at the prim.

Parameters
  • static_friction – Static friction coefficient (unitless).

  • dynamic_friction – Dynamic friction coefficient (unitless).

  • restitution – Restitution coefficient (unitless).

  • input_prims – The prims to be modified. If using with syntax, this argument can be omitted.

Example

>>> import omni.replicator.core as rep
>>> with rep.create.cube():
...     rep.physics.physics_material(
...         static_friction=rep.distribution.uniform(0.0, 1.0),
...         dynamic_friction=rep.distribution.uniform(0.0, 1.0),
...         restitution=rep.distribution.uniform(0.0, 1.0)
...     )
omni.replicator.core.physics.physics_material
omni.replicator.core.physics.rigid_body(velocity: Union[ReplicatorItem, Tuple[float, float, float]] = (0.0, 0.0, 0.0), angular_velocity: Union[ReplicatorItem, Tuple[float, float, float]] = (0.0, 0.0, 0.0), input_prims: List = None)
Randomizes the velocity and angular velocity of the prims specified in input_prims. If they do not have

the RigidBody API then one will be created for the prim.

Parameters
  • velocity – The velocity of the prim.

  • angular_velocty – The angular velocity of the prim (degrees / time).

  • input_prims – The prims to be modified. If using with syntax, this argument can be omitted.

Example

>>> import omni.replicator.core as rep
>>> with rep.create.cube():
...     rep.physics.rigid_body(
...         velocity=rep.distribution.uniform((0, 0, 0), (100, 100, 100)),
...         angular_velocity=rep.distribution.uniform((30, 30, 30), (300, 300, 300))
...     )
omni.replicator.core.physics.rigid_body

Utilities

omni.replicator.core.utils.auto_connect(upstream_node, downstream_node, mapping=None)

Connect downsteam node attributes to matching upstream node attributes

Parameters
  • upstream_node – Upstream node

  • downstream_node – Downstream node

omni.replicator.core.utils.compute_aabb(bbox_cache: BBoxCache, prim: str, include_children: bool = True) array

Compute an AABB for a given prim_path, a combined AABB is computed if include_children is True

Parameters
  • bbox_cache (UsdGeom.BboxCache) – Existing Bounding box cache to use for computation

  • prim_path (UsdPrim) – prim to compute AABB for

  • include_children (bool, optional) – include children of specified prim in calculation. Defaults to True.

Returns

Bounding box for this prim, [min x, min y, min z, max x, max y, max z]

Return type

np.array

omni.replicator.core.utils.create_node(node_type_id: str, **kwargs)

Helper function to create a replicator node of type node_type_id

Parameters
  • node_type_id – Node type ID

  • kwargs – Node attributes can optionally be set by specifying them as kwargs

omni.replicator.core.utils.find_prims(prim_paths: List[str], mode: str = 'instances') List[Prim]

Find prims based on specified mode

Parameters
  • prim_paths – List of paths to prims in the current stage

  • mode

    Choose from one of the following modes:[‘prims’, ‘prototypes’, ‘materials’, ‘meshes’, ‘instances’], defaults to “instances”.

    • prims - Returns the prims corresponding to the paths in prim_paths.

    • prototypes - Returns the prims corresponding to the paths in prim_paths and parses point instancers to retreive its prototypes.

    • meshes - Traverse through the prims in prim_paths and return all meshes and geomsubsets.

    • materials - Traverse through the prims in prim_paths and return all bound materials.

Raises

ValueError – Invalid mode choice

Returns

List of Usd prim objects

omni.replicator.core.utils.get_graph()

Get or create the replicator graph

omni.replicator.core.utils.get_node_targets(node: Node, attribute: str, replicatorXform: bool = True)

Get node targets from attribute

This function provides a convenient way to retrieve targets from a node attribute, and will be deprecated once multi-prim node attributes are supported.

Parameters
  • node – Node from which to get targets

  • attribute – Attribute name

  • replicatorXform – If False and a target has the attribute replicatorXform, return its leaf children.

omni.replicator.core.utils.get_usd_files(path: str, recursive: bool = False, path_filter: Optional[str] = None) List[str]

Retrieve a list of USD files at the provided path

Parameters
  • path – Path or URL to search from.

  • recursive – If True, recusively search through sub-directories.

  • path_filter – Optional regex filter to refine the search.

omni.replicator.core.utils.is_execution_node(node, on_input_only=False)

Returns True if node is an execution node.

Execution status is determined by traversing through the node’s attributes and verifying each attribute’s role.

Parameters
  • node – Node to investigate

  • on_input_only – If True, only look at the node’s input attributes

omni.replicator.core.utils.new_layer(name: str = None)

Create a new authoring layer context. Use new_layer to keep replicator changes into a contained layer. If a layer of the same name already exists, the layer will be cleared before new changes are applied.

Parameters

name – Name of the layer to be created. If ommitted, the name “Replicator” is used.

Example

>>> import omni.replicator.core as rep
>>> with rep.new_layer():
>>>     rep.create.cone(count=100, position=rep.distribution.uniform((-100,-100,-100),(100,100,100)))

Annotators

class omni.replicator.core.scripts.annotator_registry.AnnotatorParams(template, data_type, num_elems, is_2d_array)
property data_type

Alias for field number 1

property is_2d_array

Alias for field number 3

property num_elems

Alias for field number 2

property template

Alias for field number 0

class omni.replicator.core.scripts.annotator_registry.AnnotatorRegistry

Registry of annotators providing groundtruth data to writers.

register_annotator_from_aov() None

Register annotator from an Arbitrary Output Variable (AOV).

Parameters

aov – AOV name

classmethod register_annotator_from_node(name: str, input_rendervars: List[Union[str, list, omni.syntheticdata.SyntheticData.NodeConnectionTemplate]], node_type_id: str, init_params: Optional[dict] = None, render_product_idxs: tuple = (0,), output_rendervars: Optional[List[Union[str, list]]] = None, output_data_type: Optional[Any] = None, output_is_2d: bool = False, output_channels: int = 1) AnnotatorTemplate

Register annotator from an omnigraph node definition.

Parameters
  • name – Annotator name. This name will be used to retrieve the annotator from the registry and will be used as the key in the data dictionary provided to the writer.

  • input_rendervars – List of rendervars or other nodes that supply inputs to the node.

  • node_type_id – Node type ID

  • init_params – Set node attributes to static values

  • render_product_idxs – Index of render prodcuts to utilize.

  • output_rendervars – Specifies the render vars output by the node.

  • output_data_type – Specifies the output data type.

  • output_is_2d – Set to True if output is a 2D array

  • output_channels – Specifies the number of output channels of the array. Ignored if output_is_2d is set to False.

exception omni.replicator.core.scripts.annotator_registry.AnnotatorRegistryError(msg=None)

Base exception for errors raised by the annotator registry

class omni.replicator.core.scripts.annotator_registry.AnnotatorTemplate(name: str, init_params: Optional[dict] = None, render_product_idxs: Optional[List[int]] = None, device: Optional[str] = None, render_products: Optional[list] = None, template_name: Optional[str] = None)

Annotator class Annotator instances identify the annotator name, it’s initialization parameters, the render products it is tied to, as well as the name of the OmniGraph template.

Initialization parameters can be overridden with initialize(), and render products can be set with attach().

attach(render_products: Optional[List] = None)

Attach annotator to specified render products. Creates the OmniGraph nodes and connections.

Parameters

render_products – List of render products to attach the annotator to.

get_data(device: str = 'cpu') Any

Return annotator data.

Note that if calling get_data() immediately after initialization, the annotator output will not yet be available. Please allow for at least one update.

Parameters

device – Device to hold data in. Select from cpu and gpu. If gpu is selected, a warp array is returned. Note that only valid datatypes will be moved to the GPU.

initialize(**kwargs)

Initialize annotator parameters The initialization parameters of the annotator. Initialize can only be called before the annotator has been attached.

Writers

class omni.replicator.core.BasicWriter(output_dir: str, s3_bucket: Optional[str] = None, s3_region: Optional[str] = None, s3_endpoint: Optional[str] = None, semantic_types: Optional[List[str]] = None, rgb: bool = False, bounding_box_2d_tight: bool = False, bounding_box_2d_loose: bool = False, semantic_segmentation: bool = False, instance_id_segmentation: bool = False, instance_segmentation: bool = False, distance_to_camera: bool = False, distance_to_image_plane: bool = False, bounding_box_3d: bool = False, occlusion: bool = False, normals: bool = False, motion_vectors: bool = False, camera_params: bool = False, pointcloud: bool = False, image_output_format: str = 'png', colorize_semantic_segmentation: bool = True, colorize_instance_id_segmentation: bool = True, colorize_instance_segmentation: bool = True, skeleton_data: bool = False, frame_padding: int = 4, semantic_filter_predicate: Optional[str] = None)

Basic writer capable of writing built-in annotator groundtruth.

output_dir

Output directory string that indicates the directory to save the results.

s3_bucket

The S3 Bucket name to write to. If not provided, disk backend will be used instead. Default: None. This backend requires that AWS credentials are set up in ~/.aws/credentials. See https://boto3.amazonaws.com/v1/documentation/api/latest/guide/quickstart.html#configuration

s3_region

If provided, this is the region the S3 bucket will be set to. Default: us-east-1

semantic_types

List of semantic types to consider when filtering annotator data. Default: [“class”]

rgb

Boolean value that indicates whether the rgb annotator will be activated and the data will be written or not. Default: False.

bounding_box_2d_tight

Boolean value that indicates whether the bounding_box_2d_tight annotator will be activated and the data will be written or not. Default: False.

bounding_box_2d_loose

Boolean value that indicates whether the bounding_box_2d_loose annotator will be activated and the data will be written or not. Default: False.

semantic_segmentation

Boolean value that indicates whether the semantic_segmentation annotator will be activated and the data will be written or not. Default: False.

instance_id_segmentation

Boolean value that indicates whether the instance_id_segmentation annotator will be activated and the data will be written or not. Default: False.

instance_segmentation

Boolean value that indicates whether the instance_segmentation annotator will be activated and the data will be written or not. Default: False.

distance_to_camera

Boolean value that indicates whether the distance_to_camera annotator will be activated and the data will be written or not. Default: False.

distance_to_image_plane

Boolean value that indicates whether the distance_to_image_plane annotator will be activated and the data will be written or not. Default: False.

bounding_box_3d

Boolean value that indicates whether the bounding_box_3d annotator will be activated and the data will be written or not. Default: False.

occlusion

Boolean value that indicates whether the occlusion annotator will be activated and the data will be written or not. Default: False.

normals

Boolean value that indicates whether the normals annotator will be activated and the data will be written or not. Default: False.

motion_vectors

Boolean value that indicates whether the motion_vectors annotator will be activated and the data will be written or not. Default: False.

camera_params

Boolean value that indicates whether the camera_params annotator will be activated and the data will be written or not. Default: False.

pointcloud

Boolean value that indicates whether the pointcloud annotator will be activated and the data will be written or not. Default: False.

image_output_format

String that indicates the format of saved RGB images. Default: “png”

colorize_semantic_segmentation

If True, semantic segmentation is converted to an image where semantic IDs are mapped to colors and saved as a uint8 4 channel PNG image. If False, the output is saved as a uint32 PNG image. Defaults to True.

colorize_instance_id_segmentation

If True, instance id segmentation is converted to an image where instance IDs are mapped to colors. and saved as a uint8 4 channel PNG image. If False, the output is saved as a uint32 PNG image. Defaults to True.

colorize_instance_segmentation

If True, instance segmentation is converted to an image where instance are mapped to colors. and saved as a uint8 4 channel PNG image. If False, the output is saved as a uint32 PNG image. Defaults to True.

frame_padding

Pad the frame number with leading zeroes. Default: 4

semantic_filter_predicate

A string specifying a semantic filter predicate as a disjunctive normal form of semantic type, labels.

Examples :

“typeA : labelA & !labelB | labelC , typeB: labelA ; typeC: labelD” “typeA : * ; * : labelA”

Example

>>> import omni.replicator.core as rep
>>> camera = rep.create.camera()
>>> render_product = rep.create.render_product(camera, (1024, 1024))
>>> writer = rep.WriterRegistry.get("BasicWriter")
>>> import carb
>>> tmp_dir = carb.tokens.get_tokens_interface().resolve("${temp}/rgb")
>>> writer.initialize(output_dir=tmp_dir, rgb=True)
>>> writer.attach([render_product])
>>> rep.orchestrator.run()
write(data: dict)

Write function called from the OgnWriter node on every frame to process annotator output.

Parameters

data – A dictionary containing the annotator data for the current frame.

class omni.replicator.core.FPSWriter
on_final_frame()

Run after final frame is written.

write(data)

Write ground truth.

class omni.replicator.core.KittiWriter(output_dir: str, semantic_types: Optional[List[str]] = None, omit_semantic_type: bool = False, bbox_height_threshold: int = 25, partly_occluded_threshold: float = 0.5, fully_visible_threshold: float = 0.95, renderproduct_idxs: Optional[List[tuple]] = None, mapping_path: Optional[str] = None, colorize_instance_segmentation: bool = False, semantic_filter_predicate: Optional[str] = None)
Writer outputting data in the KITTI annotation format http://www.cvlibs.net/datasets/kitti/

Development work to provide full support is ongoing.

Supported Annotations:

RGB Object Detection (partial 2D support, see notes) Depth Semantic Segmentation Instance Segmentation

Notes

Object Detection Bounding boxes with a height smaller than 25 pixels are discarded

Supported: bounding box extents, semantic labels Partial Support: occluded (occlusion is estimated from the area ratio of tight / loose bounding boxes) Unsupported: alpha, dimensions, location, rotation_y, truncated (all set to default values of 0.0)

on_final_frame()

Run after final frame is written.

write(data)

Write ground truth.

class omni.replicator.core.Writer

Base Writer class.

Writers must specify a list of required annotators which will be called during data collection and which return their output in a data dict of the form <annotator_name>: <annotator_data>.

An optional on_final_frame function can be defined to run on the final data writing frame.

on_final_frame()

Run after final frame is written.

abstract write(data: dict)

Write ground truth.

omni.replicator.core.scripts.writers.tools.binary_mask_to_rle(binary_mask)

Convert a Binary Mask to RLE format neeeded by Pycocotools: Args: binary_mask - numpy.array of 0’s and 1’s representing current segmentation returns - data in RLE format to be used by pycocotools.

omni.replicator.core.scripts.writers.tools.colorize_bbox_2d(image, data)

Colorizes 2D bounding box data for visualization.

Parameters

data (ndarray) – 2D bounding box data from the annotator.

Returns

Data converted to uint8 RGB image, which the outline of the bounding box is colored.

Return type

(np.array)

omni.replicator.core.scripts.writers.tools.colorize_distance(distance_data, near=1e-05, far=100)

Convert distance in meters to grayscale image.

Parameters
  • distance_data (numpy.array) – data returned by the annotator.

  • near (int) – near value to clip the distance_data.

  • far (int) – far value to clip the distance_data.

Returns

Data converted to uint8 from (0, 255)

Return type

(np.array)

omni.replicator.core.scripts.writers.tools.colorize_motion_vector(data)

Convert motion vector into colored image. The conversion is done by mapping 3D direction vector to HLS space, then converted to RGB.

Parameters

data (numpy.array) – data returned by the annotator of shape (H, W, 4).

Returns

Data converted to uint8 RGBA image.

Return type

(np.array)

omni.replicator.core.scripts.writers.tools.colorize_normals(data)

Convert normals data into colored image.

Parameters

data (ndarray) – data returned by the annotator.

Returns

Data converted to uint8 RGB image.

Return type

(np.array)

omni.replicator.core.scripts.writers.tools.colorize_segmentation(data, labels, mapping=None)

Convert segmentation data into colored image.

Parameters
  • data (numpy.array) – data returned by the annotator.

  • dict (labels) – label data mapping semantic IDs to semantic labels - {“0”: {“class”:”cube”}, “1”: {“class”, “sphere”}}

  • mapping (dict) – mapping from ids to labels used for retrieving color {(255, 0, 0): {“class”:”cube”}, (0, 255, 0)}: {“class”:”sphere”}}

Returns

Data coverted to uint8 RGBA image and remapped labels

Return type

Tuple[np.array, dict]

omni.replicator.core.scripts.writers.tools.random_colours(N, enable_random=True, num_channels=4)

Generate random colors. Generate visually distinct colours by linearly spacing the hue channel in HSV space and then convert to RGB space.

Triggers

omni.replicator.core.trigger.on_frame(interval: int = 1, num_frames: int = 0, name: str = 'on_frame')

Execute on a specific generation frame.

Parameters
  • interval – The generation frame interval to execute on.

  • num_frames – The total number of frames to execute on.

omni.replicator.core.trigger.on_key_press(key)

Execute when a keyboard key is input.

Parameters

key – The key to listen for.

omni.replicator.core.trigger.on_time(interval: float = 1, num: int = 0, name: str = 'on_time')

Execute on a specific time interval. This is based on clock time.

Parameters
  • interval – The interval of elapsed time to execute on.

  • num – The number of times to execute.

  • name – The name of the trigger.

omni.replicator.core.trigger.register(fn, override=True)

Orchestrator

omni.replicator.core.orchestrator.get_frames_to_write()
omni.replicator.core.orchestrator.get_is_started()
omni.replicator.core.orchestrator.get_is_stopped()
omni.replicator.core.orchestrator.get_start_frame()
omni.replicator.core.orchestrator.get_stop_frame()
omni.replicator.core.orchestrator.preview()

Run the replicator scenario for a single iteration. Writers are disabled during preview.

omni.replicator.core.orchestrator.run()

Run the replicator scenario

omni.replicator.core.orchestrator.run_until_complete()

Run the replicator scenario until stopped Generation ends when all triggers have reached their end condition or when a stop event is published.

async omni.replicator.core.orchestrator.run_until_complete_async()

Run the replicator scenario until stopped Generation ends when all triggers have reached their end condition or when a stop event is published.

omni.replicator.core.orchestrator.step()
async omni.replicator.core.orchestrator.step_async()
omni.replicator.core.orchestrator.stop()

Stop the replicator scenario

Settings

omni.replicator.core.settings.carb_settings(setting: str, value: Union[List, float, ReplicatorItem])

Set a specific carb setting

Parameters
  • setting – Carb setting to modify.

  • value – Modified carb value.

omni.replicator.core.settings.set_render_pathtraced(samples_per_pixel: Union[int, ReplicatorItem] = 64)

Setup PathTraced render mode

Parameters

samples_per_pixel – Select the total number of samples to sample for each pixel per frame. Valid range [1, inf]

omni.replicator.core.settings.set_render_rtx_realtime(antialiasing: Union[str, ReplicatorItem] = 'FXAA')

Setup RTX Realtime render mode

Parameters

antialiasing – Antialiasing algorithm. Select from [FXAA, DLSS, TAA, RTXAA]. FXAA is recommended for non-sequential data generation as it does not accumulate samples across frames.

omni.replicator.core.settings.set_stage_meters_per_unit(meters_per_unit)

Set up the meters per unit for the stage.

omni.replicator.core.settings.set_stage_up_axis(up_axis)

Set the up axis of the stage