6. ShapeNet Importer Tutorial

6.1. Learning Objectives

This tutorial demonstrates how to import the ShapeNet V2 3D model database into Omniverse Isaac Sim as USD files. After this tutorial, you will know how to create a local shapenet repository and import assets from the ShapeNet database into your experiments and simulations.

5-10 Minute Tutorial

6.2. Getting Started

Prerequisites

  • Please review the Essential Tutorial series, especially Isaac Sim Workflows, prior to beginning this tutorial.

  • This extension requires Google Chrome to fully function since uses the selenium python package for login automation.

  • This extension requires a valid ShapeNet login to download and import ShapeNet models into Omniverse. Please register a ShapeNet account at shapenet.org prior to using this extension.

Note

If the shapenet database is already downloaded, or you want to use a more permanent location for the local model storage you can set the environment variable SHAPENET_LOCAL_DIR, for example: export SHAPENET_LOCAL_DIR=$HOME/shapenet

Creating the Database

Let’s begin by creating the Shapenet Index Database. This procedure will only happen one time if you have SHAPENET_LOCAL_DIR set, or after each install of Omniverse Isaac Sim.

If you already have per opening the ShapeNet Extension and signing in to your ShapeNet account:

  1. Go to the top menu bar and click Isaac Utils > ShapeNet Importer.

  2. Press the Create Shapenet Database Index File button to enter your ShapeNet account info, or leave it blank if you have a local copy of shapenet already. Click Sign In.

  3. The extension will launch your browser and automatically logs into shapenet.org.

  4. If a browser window did open, please wait for the browser to close before proceeding.

Upon successful log-in, or finding of local shapenet copy, the ShapeNet Importer Extension uses the CSV files from the ShapeNet V1 database. These CSV files are used to build a Shapenet Index Database, which is just a list of valid shapnetId mapped to the class names associated with them.

You will know the Shapenet Index Database was created successfully if you see the Add A Model button instead of the Create Shapenet Database Index File button.

The ShapeNet Importer Extension is now ready for use!

6.3. Using the ShapeNet Importer Extension

There are three ways to add models using this extension:

  1. Use the Omniverse Isaac Sim User Interface

  2. Use the Python API

  3. Use a Jupyter Notebook (via HTTPS Requests).

This section details the use and benefits of each method.

6.3.1. Add a Model via User Interface

The first method is using the Add A Model button in the Extension. This is recommended for when learning the extension, and when adding a small number of specific models.

To add a model:

  1. Click the Add A Model at the bottom of the ShapeNet Settings.

  2. This will download the given modal to local machine storage without change,

  3. Convert it to USD and store it on omniverse.

  4. Add it to the Scene.

  • Use the synsetId and modelId to set exact ids. You can also set the the string “random”.

  • The transform parameters creates the origin of the downloaded model.

  • There are also settings to add physics with or without convex decomposition for collision.

6.3.2. Add a Model via Python API

The second method to use Shapenet by using its Python API.

6.3.3. Add Shapes via Jupyter Notebook

Omniverse Isaac Sim provides a jupyter notebook in the ShapeNet extension folder at exts/omni.isaac.shapenet/omni/isaac/shapenet/ShapeNet Python Example.ipynb.

The Jupyter Notebook example relies on HTTPS Requests to connect to ShapeNet. Open the notebook to see how the http command is formatted there.

  • When the Isaac Shapenet extension is added to Isaac Sim, it starts a http server listening for POST commands.

  • The default address is localhost:7001.

Here is the first example in that file, which can be run from any python session — not just a jupyter notebook.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# import and place one model
from comm_kit import *

comm = setup()
command = {}

command['omniverseServer'] = 'localhost'
command['synsetId'] = '02691156'
command['modelId'] = 'dd9ece07d4bc696c2bafe808edd44356'
# The following command components are optional
command['pos'] = (10.0, 11.0, 120.0)
command['rot'] = ((0.0,0.0,1.0), 90.0)
command['scale'] = 1.1
command['auto_add_physics'] = 0 # 1 if you want to add physics to the shapenet object.
command['use_convex_decomp'] = 0 # 1 if you want to break complex shapes into pieces, for more accurate collisions.
command['do_not_place'] = 0 # 1 if you want to only convert and skip placing the shape in kit's current stage.
command['g_omni_shape_loc'] = "/Projects/shapenet" # This is where the converted files are placed, if they don't
                                                        # already exist on the server.  Or pulled from if they do.
command['g_local_shape_loc'] = "F:/shapenet/ShapeNetCorev2" # This is the local hard drive location used where the obj
                                                            # obj files that are converted are kept.  This should just
                                                            # be a local copy of the original shapenet core 2
command['g_root_usd_namespace_path'] = "/shapenet" # this is the prim path in the scene used to store the models.


print(comm.post_command(command))

6.4. Summary

This tutorial covered the following topics:

  1. Connecting Omniverse Isaac Sim to ShapeNet.

  2. Adding Models from ShapeNet into a scene via User Interface.

  3. Adding Models from ShapeNet into a scene via Python API.

  4. Adding Models from ShapeNet into a scene via Jupyter Notebook and HTTPS Requests.

6.4.1. Further Learning

For a more in-depth look into the concepts covered in this tutorial, please see the following reference materials: