Error in rep.randomizer.choice function

Whenever I try to use the rep.distribution.choice function (in this case use it to randomize dome lighting in each frame), about half of the frames are output with no dome light. Does anyone have any information on this bug and how to get around it?

Hi Michael. Do you have a quick code snippet as a repro I can try? If my guess if correct, we’re aware of this bug, but it would be helpful to confirm.

Thanks!

@michael.wood3 Here’s a workaround for domelights not being rendered in some frames. Add the following line to your script:

rep.settings.carb_settings("/omni/replicator/RTSubframes", 3)

Here’s my full script I tested to ensure it fixes the issue:

import omni.replicator.core as rep

with rep.new_layer():

    camera = rep.create.camera(position=(500, 500, 500), look_at=(0,0,0))
    render_product = rep.create.render_product(camera, (1024, 1024))
    
    # Add a test cube
    cube = rep.create.cube(semantics=[('class', 'cube')],  position=(0, 0, 0) )
    
    # Setting to work around domelight white background issue
    rep.settings.carb_settings("/omni/replicator/RTSubframes", 3)
    
    def dome_lights():
        lights = rep.create.light(
            light_type="Dome",
            rotation= (270,0,0),
            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(num_frames=10,interval=10):
        rep.randomizer.dome_lights()

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

Hopefully this should resolve the issue!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.