Skip to content

Commit

Permalink
feat build usd-from-gltf container
Browse files Browse the repository at this point in the history
That should convert .glb and .gltf files into .usdz
  • Loading branch information
leon committed Dec 15, 2019
0 parents commit a50e696
Show file tree
Hide file tree
Showing 6 changed files with 94 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.DS_Store
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Convert .glb and .gltf into apples .usdz quicklook files.

It uses this repo under the hood.
https://github.com/google/usd_from_gltf#compatibility

# Run
Using helper script that will output a usdz file with same name as input
```
./run.sh my-file-in-same-directory.glb
```

Using raw docker command
```
docker run \
--rm \
-v $(PWD):/usr/app \
leon/usd-from-gltf:latest \
inputfile.glb \
outputfile.usdz
# or on one line
docker run -it --rm -v $(PWD):/usr/app leon/usd-from-gltf:latest inputfile.glb outputfile.usdz
```

# Build
```
./build.sh
```
11 changes: 11 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh

# Build USD container
docker build usd -t leon/usd

# Build gltf_to_usdz container
docker build usd-from-gltf -t leon/usd-from-gltf

# Push
docker push leon/usd:latest
docker push leon/usd-from-gltf:latest
2 changes: 2 additions & 0 deletions run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
docker run -it --rm -v $(PWD):/usr/app leon/usd-from-gltf:latest "$@" "${@%.*}.usdz"
29 changes: 29 additions & 0 deletions usd-from-gltf/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Since USD takes so long to build, we separate it into it's own container
FROM leon/usd:latest

WORKDIR /usr/src/ufg

# Configuration
ARG UFG_RELEASE="3bf441e0eb5b6cfbe487bbf1e2b42b7447c43d02"
ARG UFG_SRC="/usr/src/ufg"
ARG UFG_INSTALL="/usr/local/ufg"
ENV USD_DIR="/usr/local/usd"
ENV LD_LIBRARY_PATH="${USD_DIR}/lib:${UFG_SRC}/lib"
ENV PATH="${PATH}:${UFG_INSTALL}/bin"
ENV PYTHONPATH="${PYTHONPATH}:${UFG_INSTALL}/python"

# Build + install usd_from_gltf
RUN git init && \
git remote add origin https://github.com/google/usd_from_gltf.git && \
git fetch --depth 1 origin "${UFG_RELEASE}" && \
git checkout FETCH_HEAD && \
python "${UFG_SRC}/tools/ufginstall/ufginstall.py" -v "${UFG_INSTALL}" "${USD_DIR}" && \
cp -r "${UFG_SRC}/tools/ufgbatch" "${UFG_INSTALL}/python" && \
rm -rf "${UFG_SRC}" "${UFG_INSTALL}/build" "${UFG_INSTALL}/src"

RUN mkdir /usr/app
WORKDIR /usr/app

# Start the service
ENTRYPOINT ["usd_from_gltf"]
CMD ["usd_from_gltf"]
23 changes: 23 additions & 0 deletions usd/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM python:2-slim-buster

WORKDIR /usr/src/usd

# Configuration
ARG USD_RELEASE="19.11"
ARG USD_INSTALL="/usr/local/usd"
ENV PYTHONPATH="${PYTHONPATH}:${USD_INSTALL}/lib/python"
ENV PATH="${PATH}:${USD_INSTALL}/bin"

# Dependencies
RUN apt-get -qq update && apt-get install -y --no-install-recommends \
git build-essential cmake nasm \
libglew-dev libxrandr-dev libxcursor-dev libxinerama-dev libxi-dev zlib1g-dev && \
rm -rf /var/lib/apt/lists/*

# Build + install USD
RUN git clone --branch "v${USD_RELEASE}" --depth 1 https://github.com/PixarAnimationStudios/USD.git /usr/src/usd
RUN python ./build_scripts/build_usd.py -v --no-usdview "${USD_INSTALL}" && \
rm -rf "${USD_REPO}" "${USD_INSTALL}/build" "${USD_INSTALL}/src"

# Share the volume that we have built to
VOLUME ["/usr/local/usd"]

0 comments on commit a50e696

Please sign in to comment.
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy