Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ linux/cert/*.pem
.pydevproject
.cproject
.settings/
.vscode/
downloads/*
Testing
91 changes: 40 additions & 51 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,72 +1,61 @@
# USD in a Docker Container

In this repository you will find a set of docker build scripts which will
download all the Open Source packages required to build Pixar's
Universal Scene Description, as well as USD itself.
This repository contains build scripts for minimal linux docker container with USD.

If you are running a linux supported by nvidia-docker you can also run usdview
interactively using the run.sh script, including CUDA acceleration for OpenSubdiv.
Otherwise you can still use most tools such as usdcat.
## usd-lite

The image tagged "usd-docker/vfx:centos7-usd-latest" will be very similar to a VFX Platform 2016
except for the Qt version still being at 4.8 as USD doesn't support Qt-5 and PySide-2 just yet.

The image tagged "usd-docker/usd:centos7-usd-latest" is built from the vfx one and adds
USD.

We will not release pre-built images on Docker Hub for now as they are big and
will contain dozens of OSS packages with very different licenses.
### To run:
```bash
docker run --rm -v $HOME:$HOME dockerusd/usd-lite:20.08-centos7 usdtree $HOME/Downloads/Kitchen_set/Kitchen_set.usd

# ->
#/
# `--Kitchen_set [def Xform] (kind = assembly)
# |--Arch_grp [def Xform] (kind = group)
# | `--Kitchen_1 [def]
# `--Props_grp [def Xform] (kind = group)
#...
```

It can be used as a provider for `usdcat` and `usdresolve` for the `AL_usd_vscode_extension` VSCode extension, just use these settings:
```
# usdcat which exposes the whole $HOME folder to the docker container
docker run --rm -v ${HOME}:${HOME} usd-docker/usd-lite:20.08-centos7 usdcat --usdFormat usda "{inputPath}"
# usdresolve which exposes the whole $HOME folder to the docker container
docker run --rm -v ${HOME}:${HOME} usd-docker/usd-lite:20.08-centos7 usdresolve --anchorPath "{anchorPath}" "{inputPath}"
```

To build locally:
### To build locally:
```bash
cd linux
./build-centos7.sh
./build-centos7-lite.sh
```

To run usdview once built:
## usd-jupyter
### To run:
First place the USD files you wish to inspect in a folder called `work` in your home directory.

```bash
wget https://developer.apple.com/arkit/gallery/models/retrotv/retrotv.usdz --output-document=../data/retrotv.usdz
./run-centos7.sh usdview /data/retrotv.usdz
docker run -it --rm -p 8888:8888 -e JUPYTER_ENABLE_LAB=yes -v ~/work:/home/jovyan/work dockerusd/usd-jupyter
# Then click on the printed url in the console to open the Jupyter notebook in your browser
```
See this example Jupyter notebook file: [USDBasics.ipynb](./USDBasics.ipynb) which can open the Pixar Kitchen Set USD file and
inspect the content interactively. To try this download the [Pixar Kitchen Set](http://graphics.pixar.com/usd/downloads.html) in the `work` folder, copy the `USDBasics.ipynb` in the folder alongside the `Kitchen_set.usd` file and open that notebook.

To build with maya
### To build locally:
```bash
cd linux
./build-centos7_maya.sh 2018
./build-jupyter.sh
```
# Goals
Most of the previously available docker images are now available in the newer and more regularly maintained [ASWF docker images](https://github.com/AcademySoftwareFoundation/aswf-docker).

## Roadmap
At this stage this repository is used to test our AL_USDMaya plugin in a Animal Logic independent way and we are sharing it
because it might help others when building USD.

This repository can also help evaluate USD as it makes all USD tools available
within the docker container, these include usdview (with full GL and CUDA acceleration)
and usdcat with Alembic support.

## Goals
The main goal of this work is to ensure correct builds and automated tests of our AL_USDMaya plugin, as well as being
a technology exploration, it is good to see the progress done by docker and nvidia on supporting GPU acceleration in
containers.

One potential future goal could be to provide standard ways to build VFX Platform packages.

## Build requirements
For easiest build you need a recent version of linux with Docker-1.9 and
nvidia-docker.
If you are on a platform not supported by docker-1.9 (such as CentOS-6) you can
still build the images but running them is a lot trickier as nvidia-docker is
not available and you have to manually create the volume containing the NVidia driver.

The builds have been tested on CentOS-6 and Ubuntu-14-10.

### Maya images
We provide a few Dockerfiles that rely on having a maya devkit tarball available. Unfortunately the recent devkit are not accessible without Autodesk accounts which means we cannot provide automatic downloads for these.
This repository now contains minimal images that can help running USD inside VSCode or in Jupyter notebooks.

We have tried to simplify the process by allowing you to download the tarballs and place them in a `downloads` folder and they will be fed to the build via a temporary python http server... this is not for the feint of heart. We would like to improve this in the future by "configuring" the Dockerfiles for specific targets depending on which builds are required.
# Build requirements
For easiest build you need a recent version of linux with Docker-1.9, navigate to the "linux" folder and run the `build-XYZ.sh` scripts.

## Credits:
# Credits:
* For USD: http://openusd.org
* For Docker: https://www.docker.com/
* For the GPU-enabled docker base images: https://github.com/NVIDIA/nvidia-docker
* For the VFX Platform docker build inspiration: https://github.com/EfestoLab/docker-buildGaffer
* For ASWF docker packages: https://github.com/AcademySoftwareFoundation/aswf-docker
148 changes: 148 additions & 0 deletions USDBasics.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# USD Basics\n",
"\n",
"## Print USD Version"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"USD v0.20.8\n"
]
}
],
"source": [
"from pxr import Usd\n",
"print(\"USD v\" + \".\".join(map(str, Usd.GetVersion())))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Open the Kitchen Set USD file"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Stage root layer: /home/jovyan/work/Kitchen_set.usd\n"
]
}
],
"source": [
"stage = Usd.Stage.Open(\"Kitchen_set.usd\")\n",
"print(f\"Stage root layer: {stage.GetRootLayer().realPath}\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Iterate Prims"
]
},
{
"cell_type": "code",
"execution_count": 27,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"prim / []\n",
"prim /Kitchen_set [Xform]\n",
"prim /Kitchen_set/Arch_grp [Xform]\n",
"prim /Kitchen_set/Arch_grp/Kitchen_1 [Xform]\n",
"prim /Kitchen_set/Arch_grp/Kitchen_1/Geom [Xform]\n",
"prim /Kitchen_set/Arch_grp/Kitchen_1/Geom/Cabinets [Xform]\n",
"prim /Kitchen_set/Arch_grp/Kitchen_1/Geom/Cabinets/Body [Xform]\n",
"prim /Kitchen_set/Arch_grp/Kitchen_1/Geom/Cabinets/Body/pCube251 [Mesh]\n",
"prim /Kitchen_set/Arch_grp/Kitchen_1/Geom/Cabinets/Body/pCube277 [Mesh]\n",
"prim /Kitchen_set/Arch_grp/Kitchen_1/Geom/Cabinets/Body/pCube278 [Mesh]\n",
"..................................................................................................................................................................................................................................................................................\n",
"The kitchen contains 2742 prims!\n"
]
}
],
"source": [
"for numPrims, prim in enumerate(Usd.PrimRange(stage.GetPseudoRoot())):\n",
" if numPrims < 10: # Only print the first 10 prims\n",
" print(f\"prim {prim.GetPath()} [{prim.GetTypeName()}]\")\n",
" elif numPrims % 10 == 1: # Otherwise print a dot for every 10 prims\n",
" print(\".\", end = '')\n",
"print(\"\")\n",
"print(f\"The kitchen contains {numPrims} prims!\")"
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"The kitchen contains 203832 points!\n"
]
}
],
"source": [
"from pxr import UsdGeom\n",
"numPoints = 0\n",
"for prim in Usd.PrimRange(stage.GetPseudoRoot()):\n",
" if prim.IsA(UsdGeom.PointBased):\n",
" pb = UsdGeom.PointBased(prim)\n",
" numPoints += len(mesh.GetPointsAttr().Get())\n",
"print(f\"The kitchen contains {numPoints} points!\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.5"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
11 changes: 0 additions & 11 deletions azure-pipelines.yml

This file was deleted.

41 changes: 0 additions & 41 deletions linux/build-centos7-lite.sh

This file was deleted.

47 changes: 0 additions & 47 deletions linux/build-centos7.sh

This file was deleted.

Loading