README
Getting Started
Build
Windows Run .\build.bat -r
Linux Run ./build.sh -r
Note:
-r
will produce the release build only, leave out if you need the debug build
Launch
Windows Run .\_build\windows-x86_64\release\omni_replicator.bat
Linux Run ./_build/linux-x86_64/release/omni_replicator.sh
Testing
Windows Run .\repo.bat test
Linux Run ./repo.sh test
Note: A specific test file can be targeted by adding the
-f <partial file name>
flag. (ie.-f onframe
)
Example
Launch omni.replicator and open the Script Editor (Window->Script Editor
), then run the following script:
import omni.replicator.core as rep
BASE = 'omniverse://ov-content/Users/jlafleche@nvidia.com/Where_is_TJ/'
TJ = 'omniverse://ov-content/Users/ecameracci@nvidia.com/Toy_Jensen_Copy/Collected_ToyJensen/ToyJensen.usd'
def env_props(size=50):
instances = rep.randomizer.instantiate(rep.utils.get_usd_files(BASE + 'props'), size=size, mode='point_instance')
with instances:
rep.modify.pose(
position=rep.distribution.uniform((-500, 0, -500), (500, 0, 500)),
rotation=rep.distribution.uniform((0,-180, 0), (0, 180, 0)),
)
return instances.node
def toy_jensen():
tj = rep.create.from_usd(BASE + "TJ/TJ.usd", semantics=[('class', 'toy_jensen')])
with tj:
with rep.get.prims("shirt|pants", prim_types=["Mesh"]):
rep.randomizer.materials(rep.get.prims("Toy_JHH_MDL_Ver", prim_types=["Material"]))
rep.modify.pose(
position=rep.distribution.uniform((-500, 0, -500), (500, 0, 500)),
rotation=rep.distribution.uniform((0,-45, 0), (0, 45, 0)),
)
return tj
rep.randomizer.register(env_props)
rep.randomizer.register(toy_jensen)
with rep.new_layer():
# Setup the static elements
env = rep.create.from_usd(BASE + 'env/room.usd')
table = rep.create.from_usd(BASE + 'env/table.usd')
# Setup camera and attach it to render product
camera = rep.create.camera(
focus_distance=800,
f_stop=0.5
)
# Setup randomization
with rep.trigger.on_frame(num_frames=10000):
rep.randomizer.env_props(75)
rep.randomizer.toy_jensen()
with camera:
rep.modify.pose(position=rep.distribution.uniform((-500, 200, 1000), (500, 500, 1500)), look_at=table)
render_product = rep.create.render_product(camera, resolution=(1024, 1024))
# Initialize and attach writer
writer = rep.WriterRegistry.get("BasicWriter")
writer.initialize(output_dir="_output", rgb=True, bounding_box_2d_tight=True)
writer.attach([render_product])
Replicator Orchestration
Preview SDG
In the script editor, run
rep.orchestrator.preview()
In the toolbar, find the
Replicator
menu and selectPreview
Run SDG
In the script editor, run
rep.orchestrator.run()
In the toolbar, find the
Replicator
menu and selectRun
Stop SDG
In the script editor, run
rep.orchestrator.stop()
In the toolbar, find the
Replicator
menu and selectStop