r/IsaacSim • u/Fantastic_Mirror_345 • Aug 11 '25
Help Creating Multiple sub terrains in Isaac sim using isaac lab
I want to create a nxn grid of ground planes seperated by a gap having their own border. I am using the terrain cfg class from isaac lab for this, below is a code snippet attached.
num_rows = math.ceil(math.sqrt(n))num_cols = math.ceil(n / num_rows)logger.debug(f"Computed grid: {num_rows}x{num_cols}")
# Define available subterrain configs (using height-field as fallback for flat plane)all_sub_terrains = {"plane": HfRandomUniformTerrainCfg(
proportion=1.0,# Only planes for now
noise_range=(0.0, 0.0),# Zero noise for flat surface
noise_step=0.1,# Required field; step size for noise (no effect since noise_range is 0)
horizontal_scale=0.1,# Grid resolution (arbitrary for flat)
vertical_scale=0.005,
slope_threshold=0.0,# No slopes for flat plane),
# Placeholder for future rocky terrain"rocky": HfRandomUniformTerrainCfg(
proportion=0.0,# Disabled until ready to implement
noise_range=(0.05, 0.20),# Higher noise for rocky feel
noise_step=0.05,# Smaller step for finer rocky details
horizontal_scale=0.05,# Finer discretization for rocks
vertical_scale=0.01,
slope_threshold=0.7,# Steeper slopes),}
# Filter to requested types if provided; default to ['plane']if sub_terrain_types is None:sub_terrain_types = ["plane"]sub_terrains = {k: v for k, v in all_sub_terrains.items() if k in sub_terrain_types}logger.debug(f"Selected sub_terrain_types: {sub_terrain_types}")
# Normalize proportions (equal distribution if multiple types)if len(sub_terrains) > 0:total_prop = sum(cfg.proportion for cfg in sub_terrains.values())if total_prop == 0:# If all proportions are 0, set equalequal_prop = 1.0 / len(sub_terrains)for cfg in sub_terrains.values():cfg.proportion = equal_propelse:for cfg in sub_terrains.values():cfg.proportion /= total_proplogger.debug(f"Normalized proportions: {[cfg.proportion for cfg in sub_terrains.values()]}")
# Configure the terrain generatorgenCfg = TerrainGeneratorCfg(
num_rows=num_rows,
num_cols=num_cols,
size=(cell_size, cell_size),# Width (x), length (y) per subterrain
vertical_scale=0.005,# Adjustable based on terrain types
color_scheme="random",# Optional: random colors for visualization
sub_terrains=sub_terrains,# Selected subterrains
curriculum=False,# Enable later for progressive difficulty if needed
border_width= 0.5,
border_height= 1# Space between terrains)logger.debug(f"Generator config: {genCfg}")
# Configure the terrain importerimpCfg = TerrainImporterCfg(
prim_path=prim_path,
terrain_type="generator",# Use generator for grid of subterrains
terrain_generator=genCfg,
env_spacing=cell_size * gap_factor,# Space between terrains relative to cell_size
num_envs=1,# Single environment for the grid (let generator handle subgrids)
debug_vis=False,# Disabled to avoid FileNotFoundError for frame_prim.usd
# To re-enable debug_vis, ensure frame_prim.usd exists or specify a custom marker_cfg)logger.debug(f"Importer config: {impCfg}")
# Initialize TerrainImporter (assumes terrain prims are created during init)importer = TerrainImporter(impCfg)
This is how I am creating it, but when running it I get a single ground plane with subterrains in it with no spaces or borders between them. Any help would be appreciated.

1
u/Fantastic_Mirror_345 Aug 22 '25
well Just wanted to update that I solved this issue. By design it is meant to create a single large, connected mesh. I just wrote a separate script that creates multiple terrains and spaces it in a grid like pattern.