ShapeNet

../_images/isaac_shapenet_shapes.png

The ShapeNet Extension allows users to import 3D models from the ShapeNet V2 database at shapenet.org into Omniverse as USD files.

Enable ShapeNet Importer

To enable the extension: Locate the Extension Manager in your app, Search for ShapeNet, and Enable the Extension.

To open the extension UI click on Isaac Utils -> ShapeNet Loader

../_images/isaac_shapenet_ui.png

Running ShapeNet Importer for the first time.

In order to download and import ShapeNet models into Omniverse, you will need a valid login to shapenet.org. Please register a ShapeNet account at shapenet.org if you don’t already have one.

Click the Create Shapenet Database Index File, enter your account info and click Sign In.

The extension will launch your browser and log into shapenet.org. Please wait a bit for the browser to be closed.

Shapenet Index Database

Once logged in for the first time, the extension downloads the csv files from ShapeNet V1 database to build a Shapenet Index Database, which is just a list of valid shapnetIds and the class names associated with them.

The ShapeNet button will change from Create Shapenet Database Index File to Add A Model if login and Shapenet Index Database creation was successful.

This only needs to be done once, unless your local storage is deleted or its location is changed.

Local Database Storage

The ShapeNet extension can download models from shapenet.org. If you already download the ShapeNet v2 database locally, you can set an environment variable SHAPENET_LOCAL_DIR to its location so the extension will use that v2 local copy instead of downloading individual models each time you add a model for the first time.

The SHAPENET_LOCAL_DIR variable is also used for storing downloaded models. If SHAPENET_LOCAL_DIR is not set, the extension will use the local Omniverse ${data}/shapenet folder.

Using the ShapeNet Extension

There are three ways to use the extension.

Adding a model with the UI

The first is the ShapeNet Add A Model Button which will use the ShapeNet Settings in the panel.

Click Add A Model at the bottom of the ShapeNet Settings, it will download the modal to local machine storage without change, convert it to USD and store it on omniverse, then add it to the scene.

The synsetId and modelId can be set to exact ids or set the the string “random”. The rest of the Settings parameters are the transform for where to spawn the downloaded model at. There are also checkboxes to add physics with or without convex decomposition for collision.

Adding a model with Python

The second way to use Shapenet is through Python. The main function is in the ShapeNet extension folder’s scripts\shape.py. Users can get to the ShapeNet extension folder by clicking on the Folder button in the Extension Manager.

1
def addShapePrim(omniverseServer, synsetId, modelId, pos, rot, scale, auto_add_physics, use_convex_decomp, do_not_place=False)

For an example, please see how settings.py uses that function.

Adding Shapes with HTTP requests

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.

There is a jupyter notebook located in the ShapeNet extension’s scripts folder and you can see how the http command is formatted there.

  • > jupyter notebook ShapeNet Python Example.ipynb

Here is the first example in that file, which you can 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))