ShapeNet

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

Setup

To enable the extension, navigate to Window -> Extension Manager, and select the omni.isaac.shapenet extension.

../_images/kit_utility_shapenet_checkbox.png

Shapenet.org Login

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 “Create Model ID Database”, enter your account info and click Sign In.

../_images/kit_utility_shapenet_log-in.png

The extension will launch your browser and log into shapenet.org. Please wait a bit for the browser to be closed. The ShapeNet menu will change from “Create Model ID Database” to “Add a model”.

Shape ID Database

Once logged in for the first time, the extension downloads the csv files from ShapeNet V1 database to build a model ID database. 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.

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 two main ways to use the extension.

The first is the ShapeNet dropdown menu’s “Add a model” which will show the ShapeNet Settings window with different parameters.

../_images/kit_utility_shapenet_using_shapenet.png

Click “Add a model” at the bottom of the ShapeNet Settings, it will download and import a model.

synsetId and modelId as “random” will download a random model. You can also specify the exact ids. The rest of the Settings parameters are the transform where to spawn the downloaded model at.

The second way 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 Window -> Extension Manager’s omni.isaac.shapenet above.

../_images/kit_utility_shapenet_folder_view.png
1
def addShapePrim(use_async, synsetId, modelId, pos, rot, scale, do_not_place=False):

Please see how settings.py uses that function.

Adding Shapes with External Python Session

There is a jupyter notebook located in the ShapeNet extension’s scripts folder and you can see with the command:

  • > 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
# import and place one model
from comm_kit import *

comm = setup()
command = {}

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['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'] = "omni:/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))