Instantiating dome lights

Hi,

I am trying to use dome lights to have a non-black background to the object I want to recognize. I am unable to do this as the background remains black.

This is the code I’m attempting to use:


import omni.replicator.core as rep

NUM_FRAMES = 5
RT_SUBFRAMES = 50

rep.settings.set_render_pathtraced(samples_per_pixel=64)

with rep.new_layer():

    camera = rep.create.camera(
        position=(60, 50, 200),
        look_at=(0, 0, 0)
    )

    render_product = rep.create.render_product(camera, (640, 480))

    slab = rep.create.plane(
        position=(0, 0, 0),
        scale=[0.6, 1, 0.9],
        rotation=(0, 0, 0),
        pivot=(0, 0, -0.8),
    )

    house = rep.create.cube(
        position=(-20, 0, 0),
        scale=(0.2, 0.15, 0.05),
        pivot=(0, -1, 0)
    )

    render_product = rep.create.render_product(camera, (640, 480))

    writer = rep.WriterRegistry.get("BasicWriter")
    writer.initialize(output_dir="camera_output", rgb=True)
    writer.attach([render_product])

    def dome_lights():
        lights = rep.create.light(
            light_type="Dome",
            intensity=1000,
            texture=rep.distribution.choice([
                'omniverse://localhost/NVIDIA/Assets/Skies/Cloudy/champagne_castle_1_4k.hdr',
                'omniverse://localhost/NVIDIA/Assets/Skies/Clear/evening_road_01_4k.hdr',
                'omniverse://localhost/NVIDIA/Assets/Skies/Clear/mealie_road_4k.hdr',
                'omniverse://localhost/NVIDIA/Assets/Skies/Clear/qwantani_4k.hdr'
                ])
        )
        return lights.node
    rep.randomizer.register(dome_lights)

    with rep.trigger.on_frame(max_execs=NUM_FRAMES,
                              rt_subframes=RT_SUBFRAMES):
        rep.randomizer.dome_lights()

    rep.orchestrator.run()

This is a resulting image (they all look the same):

The only error i get in the entire log is this:

and I get this warning if that is relevant:
OgnSdPostRenderVarToHost : rendervar copy from texture directly to host buffer is counter-performant. Please use copy from texture to device buffer first.

In the Kit Base Editor I am able to press Locate file on the texture indicating that it is able to find the texture.

Thanks for the help!

Edit: I now got it working with a hack. If i just run the script it doesn’t work but if I create a new dome light in the scene in the KIT app that leads to the textures being imported. Then I can remove the newly added dome light and re-run the script and it works. Very strange but at least a temporary fix.