Unable to set dome light intensity with replicator in 5.1.0

I am migrating an Isaac Sim 4.5.0 replicator extension to work with Isaac Sim 5.1.0.

Using code like this used to create a dome light and set the intensity

self.light = self.repl.create.light(
light_type=“dome”,
rotation=(0.0, 0.0, 0.0),
position=(0.0, 0.0, 100),
texture=path_to_texture,
intensity=1750.0,
exposure=1.0,
)

But when I run that in 5.1.0, I get a dome light with an intensity of 1.0.
I tried setting the intensity immediately after creating the light, but that did not work, either. I tried printing the value of self.light.node.get_attributes(), and there was an attribute named “intensity”, but when I tried to get/set the attribute, I would get an error stating that the attribute did not exist.

Eventually I gave up and started creating the dome light and setting its intensity using the USD functions like this
stage = omni.usd.get_context().get_stage()
light = UsdLux.DomeLight.Define(stage, “/Replicator/DomeLight_Xform/DomeLight”)
light.GetIntensityAttr().Set(1750)
light.GetTextureFileAttr().Set(path_to_texture)

This works for me, but leaves me wondering:
Is there a way to accomplish this with replicator?
Has the method changed between 4.5 and 5.1?
Are there consequences to doing this with USD methods instead of replicator?
If so, what should I look out for?

Hello,
you can use rep.functional

import omni.replicator.core as rep
from pxr import Sdf


dome_light = rep.functional.create.dome_light(intensity=100, name=“DomeLight”)

# Method A: Use rep.functional.modify.attribute

rep.functional.modify.attribute(dome_light, “inputs:intensity”, 200.5)

# Method B: Use USD directly on the returned prim

if dome_light.GetAttribute(“inputs:intensity”):
dome_light.GetAttribute(“inputs:intensity”).Set(300.5)
else:
dome_light.CreateAttribute(“inputs:intensity”, Sdf.ValueTypeNames.Float).Set(300.5)

I work with Jeremiah. Here’s what worked with 4.5

def set_lights(self):
        folders = [
            "omniverse://omniverse.us.COMPANY.com/Library/Environments/"
            ]
        self.scenes = []
        for folder in folders:
            self.scenes += recursive_files("hdr", [], folder)

        # Create and randomize a dome light for the DOME dataset
        def randomize_domelight(texture_paths):
            lights = rep.create.light(
                light_type="Dome",
                rotation=rep.distribution.uniform((0, 0, 0), (360, 360, 360)),
                texture=rep.distribution.choice(texture_paths),
            )
            return lights.node

        rep.randomizer.register(randomize_domelight, override=True)

        with rep.trigger.on_frame(interval=2, max_execs=self.config["num_train"] * 2 * len(self.config["cams"]) + 1):
            rep.randomizer.randomize_domelight(self.scenes)

I tried adding intensity to rep.create.light and that did nothing. Any ideas on how to fix that?

Thank you for your reply.

I tried the rep.functional approach above and I still got the same behavior (intensity is stuck at 1.0).
I also tried updating the intensity within isaac sim’s gui while replicator was running, and isaac sim popped up a message stating that my change was overridden by another layer. This reminded me of something I have been wondering for a while:
Is it possible that something somewhere else is overriding the intensity? For instance, what if my setting the intensity is actually working, but something else sets it back to 1.0 before my change can be seen? How would I check whether this is happening and if so, find the culprit?

Another idea: is it possible that my attempts to set the intensity via replicator are being ignored? I can change the texture after creating a dome light and see it take effect, but whenever I try to set the intensity, I do not see it take effect. It does not seem to matter what method I use to change the intensity. Every replicator method I have tried so far has failed. I have even tried to create a dome light without randomizing it, and every setting other than intensity seems to work just fine.
I tried not setting the intensity and it was still 1.0 even though the documentation for replicator’s create.light says the default intensity is 1000.0.

also filed this on github dome light intensity always 1.0 when created by replicator · Issue #435 · isaac-sim/IsaacSim · GitHub

Hi,

Thank you for the detailed report and follow-up. We’ve identified the root cause of this issue in Isaac Sim 5.1.0 that occurs when using rep.new_layer().

Workaround: Avoid using rep.new_layer() when creating dome lights.

The issue does not happen anymore in newer replicator version in Isaac Sim 6.0.