mattdeitke
commited on
Merge branch 'main' of https://github.com/allenai/objaverse-xl into main
Browse files- scripts/rendering/README.md +110 -4
scripts/rendering/README.md
CHANGED
@@ -1,6 +1,10 @@
|
|
1 |
-
# Objaverse-XL Rendering Script
|
2 |
|
3 |
-
|
|
|
|
|
|
|
|
|
4 |
|
5 |
1. Clone the repository and enter the rendering directory:
|
6 |
|
@@ -33,11 +37,113 @@ cd ../.. && \
|
|
33 |
cd scripts/rendering
|
34 |
```
|
35 |
|
36 |
-
## Usage
|
37 |
|
38 |
-
|
|
|
|
|
39 |
|
40 |
```bash
|
41 |
python3 main.py
|
42 |
```
|
43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# 🪐 Objaverse-XL Rendering Script
|
2 |
|
3 |
+
![Blender generated with MidJourney](https://github.com/allenai/objaverse-xl/assets/28768645/69064f78-a752-40d6-bd36-ea7c15ffa1ec)
|
4 |
+
|
5 |
+
Scripts for rendering Objaverse-XL with [Blender](https://www.blender.org/). Rendering is the process of taking pictures of the 3D objects. These images can then be used for training AI models.
|
6 |
+
|
7 |
+
## 🖥️ Setup
|
8 |
|
9 |
1. Clone the repository and enter the rendering directory:
|
10 |
|
|
|
37 |
cd scripts/rendering
|
38 |
```
|
39 |
|
40 |
+
## 📸 Usage
|
41 |
|
42 |
+
### 🐥 Minimal Example
|
43 |
+
|
44 |
+
After setup, we can start to render objects using the `main.py` script:
|
45 |
|
46 |
```bash
|
47 |
python3 main.py
|
48 |
```
|
49 |
|
50 |
+
After running this, you should see 10 zip files located in `~/.objaverse/github/renders`. Each zip file corresponds to the rendering of a unique object, in this case from [our example 3D objects repo](https://github.com/mattdeitke/objaverse-xl-test-files):
|
51 |
+
|
52 |
+
```bash
|
53 |
+
> ls ~/.objaverse/github/renders
|
54 |
+
0fde27a0-99f0-5029-8e20-be9b8ecabb59.zip 54f7478b-4983-5541-8cf7-1ab2e39a842e.zip 93499b75-3ee0-5069-8f4b-1bab60d2e6d6.zip
|
55 |
+
21dd4d7b-b203-5d00-b325-0c041f43524e.zip 5babbc61-d4e1-5b5c-9b47-44994bbf958e.zip ab30e24f-1046-5257-8806-2e346f4efebe.zip
|
56 |
+
415ca2d5-9d87-568c-a5ff-73048a084229.zip 5f6d2547-3661-54d5-9895-bebc342c753d.zip
|
57 |
+
44414a2a-e8f0-5a5f-bb58-6be50d8fd034.zip 8a170083-0529-547f-90ec-ebc32eafe594.zip
|
58 |
+
```
|
59 |
+
|
60 |
+
If we unzip one of the zip files:
|
61 |
+
|
62 |
+
```bash
|
63 |
+
> cd ~/.objaverse/github/renders
|
64 |
+
> unzip 0fde27a0-99f0-5029-8e20-be9b8ecabb59.zip
|
65 |
+
```
|
66 |
+
|
67 |
+
we will see that there is a new `0fde27a0-99f0-5029-8e20-be9b8ecabb59` directory. If we look in that directory, we'll find the following files:
|
68 |
+
|
69 |
+
```bash
|
70 |
+
> ls 0fde27a0-99f0-5029-8e20-be9b8ecabb59
|
71 |
+
000.npy 001.npy 002.npy 003.npy 004.npy 005.npy 006.npy 007.npy 008.npy 009.npy 010.npy 011.npy metadata.json
|
72 |
+
000.png 001.png 002.png 003.png 004.png 005.png 006.png 007.png 008.png 009.png 010.png 011.png
|
73 |
+
```
|
74 |
+
|
75 |
+
Here, we see that there are 12 renders `[000-011].png`. Each render will look something like one of the 4 images shown below, but likely with the camera at a different location as its location is randomized during rendering:
|
76 |
+
|
77 |
+
![temp](https://github.com/allenai/objaverse-xl/assets/28768645/69d79e26-4df1-4bd2-854c-7d3c888adae7)
|
78 |
+
|
79 |
+
Additionally, there are 12 npy files `[000-011].npy`, which include information about the camera's pose for a given render. We can read the npy files using:
|
80 |
+
|
81 |
+
```python
|
82 |
+
import numpy as np
|
83 |
+
array = np.load("000.npy")
|
84 |
+
```
|
85 |
+
|
86 |
+
where array is now a 3x4 [camera matrix](https://en.wikipedia.org/wiki/Camera_matrix) that looks something like:
|
87 |
+
|
88 |
+
```python
|
89 |
+
array([[6.07966840e-01, 7.93962419e-01, 3.18103019e-08, 2.10451518e-07],
|
90 |
+
[4.75670159e-01, -3.64238620e-01, 8.00667346e-01, -5.96046448e-08],
|
91 |
+
[6.35699809e-01, -4.86779213e-01, -5.99109232e-01, -1.66008198e+00]])
|
92 |
+
```
|
93 |
+
|
94 |
+
Finally, we also have a `metadata.json` file, which contains metadata about the object and scene:
|
95 |
+
|
96 |
+
```json
|
97 |
+
{
|
98 |
+
"animation_count": 0,
|
99 |
+
"armature_count": 0,
|
100 |
+
"edge_count": 2492,
|
101 |
+
"file_identifier": "https://github.com/mattdeitke/objaverse-xl-test-files/blob/ead0bed6a76012452273bbe18d12e4d68a881956/example.abc",
|
102 |
+
"file_size": 108916,
|
103 |
+
"lamp_count": 1,
|
104 |
+
"linked_files": [],
|
105 |
+
"material_count": 0,
|
106 |
+
"mesh_count": 3,
|
107 |
+
"missing_textures": {
|
108 |
+
"count": 0,
|
109 |
+
"file_path_to_color": {},
|
110 |
+
"files": []
|
111 |
+
},
|
112 |
+
"object_count": 8,
|
113 |
+
"poly_count": 984,
|
114 |
+
"random_color": null,
|
115 |
+
"save_uid": "0fde27a0-99f0-5029-8e20-be9b8ecabb59",
|
116 |
+
"scene_size": {
|
117 |
+
"bbox_max": [
|
118 |
+
4.999998569488525,
|
119 |
+
6.0,
|
120 |
+
1.0
|
121 |
+
],
|
122 |
+
"bbox_min": [
|
123 |
+
-4.999995231628418,
|
124 |
+
-6.0,
|
125 |
+
-1.0
|
126 |
+
]
|
127 |
+
},
|
128 |
+
"sha256": "879bc9d2d85e4f3866f0cfef41f5236f9fff5f973380461af9f69cdbed53a0da",
|
129 |
+
"shape_key_count": 0,
|
130 |
+
"vert_count": 2032
|
131 |
+
}
|
132 |
+
```
|
133 |
+
|
134 |
+
### 🎛 Configuration
|
135 |
+
|
136 |
+
### 🧑🔬️ Experimental Features
|
137 |
+
|
138 |
+
USDZ support is experimental. Since Blender does not natively support usdz, we use [this Blender addon](https://github.com/robmcrosby/BlenderUSDZ), but it doesn't work with all types of USDZs. If you have a better solution, PRs are very much welcome 😄!
|
139 |
+
|
140 |
+
## 👋 Our Team
|
141 |
+
|
142 |
+
Objaverse-XL is an open-source project managed by the [PRIOR team](//prior.allenai.org) at the [Allen Institute for AI](//allenai.org) (AI2).
|
143 |
+
AI2 is a non-profit institute with the mission to contribute to humanity through high-impact AI research and engineering.
|
144 |
+
|
145 |
+
<br />
|
146 |
+
|
147 |
+
<a href="//prior.allenai.org">
|
148 |
+
<p align="center"><img width="100%" src="https://raw.githubusercontent.com/allenai/ai2thor/main/doc/static/ai2-prior.svg" /></p>
|
149 |
+
</a>
|