Scattering 20,000 grass instances (without collision check) is not possible

Isaac Sim Version

4.0.0

Operating System

Windows 11

GPU Information

  • Model: RTX 4090 Laptop
  • Driver Version: 566.36

Steps to Reproduce

  1. scatter 20,000 instances of a small mesh using a scatter node

Screenshots or Videos

Topic Description

When i start my simulation, I scatter small patches of grass. Until now, I scattered 2000 instances.
If I increase the number of instances to 20000, the editor frizes.

this is how I initialize my scatter graph:

def init_graph(self, surface_prims_path, rand_usd_paths):
        self.graph = og.Controller.create_graph(
            graph_id = {
                "graph_path" : f"/Graphs/ScatterGraphs/grass_Graph",
                "fc_backing_type" : og.GraphBackingType.GRAPH_BACKING_TYPE_FABRIC_WITHOUT_HISTORY, 
                "pipeline_stage" : og.GraphPipelineStage.GRAPH_PIPELINE_STAGE_ONDEMAND
            }
            )

        keys = og.Controller.Keys
        _, _, _, nodes = og.Controller.edit(
            self.graph,
            {
                keys.CREATE_NODES: [
                    ("OgnScatter2D", "omni.replicator.core.OgnScatter2D"),
                    ("OgnSamplePopulation", "omni.replicator.core.OgnSamplePopulation"),
                    ("OgnCount1", "omni.replicator.core.OgnCount"),
                    ("OgnCount2", "omni.replicator.core.OgnCount"),
                    ("OgnSampleUniform", "omni.replicator.core.OgnSampleUniform"),
                    ("PerAxisPose", "omni.replicator.core.OgnPerAxisPose"),
                    ("OgnWritePrimAttribute", "omni.replicator.core.OgnWritePrimAttribute"),
                    ],
                keys.CONNECT: [
                    ("OgnSamplePopulation.outputs:prims", "OgnCount1.inputs:prims"),
                    ("OgnCount1.outputs:count", "OgnSampleUniform.inputs:numSamples"),
                    ("OgnSampleUniform.outputs:samples", "PerAxisPose.inputs:fullValues"),

                    ("OgnSamplePopulation.outputs:prims", "OgnCount2.inputs:prims"),
                    ("OgnCount2.outputs:count", "PerAxisPose.inputs:numSamples"),

                    ("OgnSamplePopulation.outputs:prims", "PerAxisPose.inputs:prims"),

                    ("PerAxisPose.outputs:samples", "OgnWritePrimAttribute.inputs:values"),
                    ("OgnSamplePopulation.outputs:prims", "OgnWritePrimAttribute.inputs:prims"),

                    ("OgnSamplePopulation.outputs:exec", "OgnScatter2D.inputs:execIn"),
                    ("OgnSamplePopulation.outputs:exec", "PerAxisPose.inputs:exec"),
                    ("PerAxisPose.outputs:exec", "OgnWritePrimAttribute.inputs:execIn"),

                    ("OgnSamplePopulation.outputs:prims", "OgnScatter2D.inputs:prims"),


                ],
                keys.SET_VALUES: [
                 
                    ("OgnSamplePopulation.inputs:paths", rand_usd_paths),
                    ("OgnSamplePopulation.inputs:mode", 'scene_instance'),
                    ("OgnSamplePopulation.inputs:useCache", False),
                    ("OgnSamplePopulation.inputs:withReplacements", False),
                    ("OgnSamplePopulation.inputs:populationName", f"{self.assets_name}_ScatterPopulation"),

                    ("OgnCount1.inputs:mode", 'prims'),

                    ("OgnSampleUniform.inputs:lower", [0,0,0]),
                    ("OgnSampleUniform.inputs:upper", [0,0,180]),
                    ("OgnSampleUniform.inputs:outputType", "float3[]"),

                    ("OgnCount2.inputs:mode", 'prims'),

                    ("PerAxisPose.inputs:mode", "rotation"),

                    ("OgnWritePrimAttribute.inputs:attribute", "xformOp:rotateXYZ"),
                    ("OgnWritePrimAttribute.inputs:attributeType", "double3"),

                    #("OgnScatter2D.inputs:surfacePrims", plane_path),   
                    ("OgnScatter2D.inputs:checkForCollisions", False),
                    ("OgnScatter2D.inputs:seed", self.seed),
                ]
            },
        )

what am i doing wrong? how is it possible to scatter many meshes in Isaac Sim?

Could you test version 4.2.0? If the issue persists, do you notice any suspicious messages? Please share the complete code for easier reproduction.

@VickNV Thank you for your responce.

here is a simple test case:

  1. create an empty stage with a plane mesh.

  2. download the attacked usd file (this is a patch of grass)
    Collected_Bunch of Grass1.zip (2.7 MB)

  3. past this code in the script editor:

import omni.replicator.core as rep

grass_usd = "<path to where the downloaded grass usd is>"

plane_path = "/World/Plane"

plane_prim = rep.get.prim_at_path(plane_path)

grass = rep.randomizer.instantiate(paths = grass_usd, size = 10000, use_cache = False)

rep.randomizer.scatter_2d(input_prims = grass, surface_prims = plane_prim)
  1. press “Run”

For this simple test case, it has been running for the last 20 minutes and the editor is still stuck (waiting for the scattering to complete).

BTW, I see that my system is not being fully utilized:

any idea on how I can better utilize my CPU and/or GPU to lower the time it takes to scatter?

Thank you