country_code

VFI Performance Considerations#

Some of the considerations below may not have a large impact on smaller spaces, but they start being felt as you scale to large factory scenarios.

Very large spanning single meshes#

The bounding box of a large spanning single mesh will end up intersecting bounding boxes many other meshes in the space. This slows down the rendering process. For more information on why the rendering process may slow, check out the useful link section below.

Bound box intersecting all prims on factory floor

Single merged mesh where bounding box intersects all other prims#

Non-intersecting bounding boxes

Multiple meshes where each are tight around the geometry and does not intersect with other prims#

How to comply:

  • Organize things in beforehand in CAD applications to avoid this issue.

  • Scene Optimizer Merge Meshes - to create the groupings for large data sets, you may want to tag prims that are to be merged together and use strict attribute mode in the merge meshes processor. You can also have other data sources that specify how things are supposed to be merged together and do the merging step via scripts.

  • To retroactively fix merged meshes use Scene Optimizer Split and Merge using spacial clustering mode.

Large mesh with majority of empty space#

Large single mesh with a majority of empty space

Large mesh with a majority of empty space#

How to comply:

High number of identical meshes and prim hierarchies#

How to comply:

Note

If there are materials at the part levels for many duplicates, it may be necessary to optimize materials (deduplicate) before you de-duplicate the geometry.

High number of basis curve intersections#

Currently basis curve intersections are slower to render. Make sure that your curve width is as small as possible to minimize the number of curve intersections in your stage. If you need an increased width, consider lowering your reliance on curves and use mesh prims instead.

How to comply:

  • Python script to find basis curves and set width.

Tip

The script can be a Scene Optimizer Python processor.

from pxr import Usd, UsdGeom, Sdf, UsdShade
import omni.usd

usd_file = "path/to/your/usd/file.usd"

# Get stage by opening a USD file
stage = Usd.Stage.Open(usd_file)
# OR
# Get stage from Kit application session
stage = omni.usd.get_context().get_stage()

# Get basis curve prim in loop and set width
for prim in stage.Traverse():
   if prim.IsA(UsdGeom.BasisCurves):
      # Create a UsdGeomBasisCurves wrapper for the prim
      curve = UsdGeom.BasisCurves(prim)

      # Get the number of curves in this BasisCurves prim
      curve_counts = curve.GetCurveVertexCountsAttr().Get()

      # Print diagnostic information
      print(f"Prim path: {prim.GetPath()}")
      print(f"Curve counts: {curve_counts}")

      # Check if points exist
      points = curve.GetPointsAttr().Get()
      print(f"Number of points: {len(points) if points is not None else 'None'}")

      # If we don't have curve counts but we have points, try to set width directly
      if curve_counts is None or len(curve_counts) == 0:
            if points is not None and len(points) > 0:
               # Try setting a constant width for the whole curve
               curve_width = 0.3 # Width in scene units
               curve.GetWidthsAttr().Set(curve_width)
               print(f"Set constant width {curve_width} for curve at {prim.GetPath()}")
            else:
               print(f"Cannot set width: No points or curve data found in {prim.GetPath()}")
      else:
            # Original approach with per-curve widths
            curve_width = 0.3 # Width in scene units
            per_curve_widths = [curve_width] * len(curve_counts)
            curve.GetWidthsAttr().Set(per_curve_widths)
            curve.SetWidthsInterpolation(UsdGeom.Tokens.uniform)
            print(f"Set width {curve_width} for {len(curve_counts)} curves in {prim.GetPath()}")

stage.Save()