Unexpected behavior : Replicator randomizes the color of certain object

Hello,

I am trying to generate a synthetic dataset and I have some objects where I explicitly randomize the color but for others I would rather not randomize the color, however, the replicator still randomizes the color.
I provide the code snipped below :

def get_shapes():
    shapes = rep.get.prims(semantics=[('class', 'UO')])
    with shapes:
        rep.randomizer.color(colors=rep.distribution.uniform((0, 0, 0), (1, 1, 1)))
        rep.modify.pose(
            position=rep.distribution.uniform((-600, 0, -400), (700, 0, 400)),
            rotation=rep.distribution.uniform((0, -180, 0), (0, 180, 0)),
            scale=rep.distribution.uniform(0.4, 0.8)
        )
    return shapes.node

def get_rocks():
    rocks = rep.get.prims(semantics=[('class', 'rock')])
    with rocks:
        rep.modify.pose(
            position=rep.distribution.uniform((-600, 0, -400), (700, 0, 400)),
            rotation=rep.distribution.uniform((0, -180, 0), (0, 180, 0)),
            scale=rep.distribution.uniform(1, 1)
        )
    return rocks.node

The problem is my rocks. Please help :)

@kaanini i am just another user passing through, and i wasn’t able to replicate the issue you are describing. i made a quick and similar snippet and replicator seems to behave expectedly with the cube is getting color and pos randomized whereas the sphere only randomizes in position. this was tested in Isaac Sim 2023.1.1.

import omni.replicator.core as rep

with rep.new_layer():

	# Add Default Light
	distance_light = rep.create.light(rotation=(315,0,0), intensity=3000, light_type="distant")	
	sphere = rep.create.sphere(semantics=[('class', 'sphere')], position=(0, 100, 100))
	cube = rep.create.cube(semantics=[('class', 'cube')],  position=(200, 200 , 100) )
	plane = rep.create.plane(scale=10, visible=True)

	def get_cubes():
		cubes = rep.get.prims(semantics=[('class', 'cube')])
		with cubes:
			rep.randomizer.color(colors=rep.distribution.uniform((0, 0, 0), (1, 1, 1)))
			rep.modify.pose(
			position=rep.distribution.uniform((-500, 50, -500), (500, 50, 500)),
			rotation=rep.distribution.uniform((0,-180, 0), (0, 180, 0)),
			scale=rep.distribution.normal(1, 0.5)
			)
		return cubes.node

	def get_spheres():
		spheres = rep.get.prims(semantics=[('class', 'sphere')])
		with spheres:
			rep.modify.pose(
			position=rep.distribution.uniform((-500, 50, -500), (500, 50, 500)),
			rotation=rep.distribution.uniform((0,-180, 0), (0, 180, 0)),
			scale=rep.distribution.normal(1, 0.5)
			)
		return spheres.node

	rep.randomizer.register(get_cubes)
	rep.randomizer.register(get_spheres)

	# Setup randomization
	with rep.trigger.on_frame(num_frames=100):
		rep.randomizer.get_cubes()
		rep.randomizer.get_spheres()
1 Like