mujoco-warp-pbr 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mujoco_warp_pbr-0.1.0/LICENSE +202 -0
- mujoco_warp_pbr-0.1.0/PKG-INFO +295 -0
- mujoco_warp_pbr-0.1.0/README.md +250 -0
- mujoco_warp_pbr-0.1.0/mujoco_warp_pbr/__init__.py +46 -0
- mujoco_warp_pbr-0.1.0/mujoco_warp_pbr/_src/__init__.py +15 -0
- mujoco_warp_pbr-0.1.0/mujoco_warp_pbr/_src/brdf.py +191 -0
- mujoco_warp_pbr-0.1.0/mujoco_warp_pbr/_src/camera.py +192 -0
- mujoco_warp_pbr-0.1.0/mujoco_warp_pbr/_src/color.py +129 -0
- mujoco_warp_pbr-0.1.0/mujoco_warp_pbr/_src/denoise.py +248 -0
- mujoco_warp_pbr-0.1.0/mujoco_warp_pbr/_src/envmap.py +576 -0
- mujoco_warp_pbr-0.1.0/mujoco_warp_pbr/_src/ibl.py +107 -0
- mujoco_warp_pbr-0.1.0/mujoco_warp_pbr/_src/io.py +619 -0
- mujoco_warp_pbr-0.1.0/mujoco_warp_pbr/_src/kernel_inputs.py +466 -0
- mujoco_warp_pbr-0.1.0/mujoco_warp_pbr/_src/launch.py +126 -0
- mujoco_warp_pbr-0.1.0/mujoco_warp_pbr/_src/lights.py +198 -0
- mujoco_warp_pbr-0.1.0/mujoco_warp_pbr/_src/material.py +550 -0
- mujoco_warp_pbr-0.1.0/mujoco_warp_pbr/_src/optix/__init__.py +86 -0
- mujoco_warp_pbr-0.1.0/mujoco_warp_pbr/_src/optix/accel.py +753 -0
- mujoco_warp_pbr-0.1.0/mujoco_warp_pbr/_src/optix/device.py +214 -0
- mujoco_warp_pbr-0.1.0/mujoco_warp_pbr/_src/optix/graph.py +214 -0
- mujoco_warp_pbr-0.1.0/mujoco_warp_pbr/_src/optix/launch.py +705 -0
- mujoco_warp_pbr-0.1.0/mujoco_warp_pbr/_src/optix/trace.py +348 -0
- mujoco_warp_pbr-0.1.0/mujoco_warp_pbr/_src/output.py +105 -0
- mujoco_warp_pbr-0.1.0/mujoco_warp_pbr/_src/pathtrace.py +429 -0
- mujoco_warp_pbr-0.1.0/mujoco_warp_pbr/_src/render.py +451 -0
- mujoco_warp_pbr-0.1.0/mujoco_warp_pbr/_src/texture.py +233 -0
- mujoco_warp_pbr-0.1.0/mujoco_warp_pbr/_src/trace.py +270 -0
- mujoco_warp_pbr-0.1.0/mujoco_warp_pbr/_src/traverse.py +325 -0
- mujoco_warp_pbr-0.1.0/mujoco_warp_pbr/_src/types.py +304 -0
- mujoco_warp_pbr-0.1.0/mujoco_warp_pbr/py.typed +0 -0
- mujoco_warp_pbr-0.1.0/mujoco_warp_pbr.egg-info/PKG-INFO +295 -0
- mujoco_warp_pbr-0.1.0/mujoco_warp_pbr.egg-info/SOURCES.txt +49 -0
- mujoco_warp_pbr-0.1.0/mujoco_warp_pbr.egg-info/dependency_links.txt +1 -0
- mujoco_warp_pbr-0.1.0/mujoco_warp_pbr.egg-info/requires.txt +27 -0
- mujoco_warp_pbr-0.1.0/mujoco_warp_pbr.egg-info/top_level.txt +1 -0
- mujoco_warp_pbr-0.1.0/pyproject.toml +149 -0
- mujoco_warp_pbr-0.1.0/setup.cfg +4 -0
- mujoco_warp_pbr-0.1.0/tests/test_benchmarks.py +179 -0
- mujoco_warp_pbr-0.1.0/tests/test_context_validation.py +161 -0
- mujoco_warp_pbr-0.1.0/tests/test_cpu.py +47 -0
- mujoco_warp_pbr-0.1.0/tests/test_denoise.py +73 -0
- mujoco_warp_pbr-0.1.0/tests/test_effects.py +161 -0
- mujoco_warp_pbr-0.1.0/tests/test_gltf_to_mjcf.py +153 -0
- mujoco_warp_pbr-0.1.0/tests/test_ibl.py +129 -0
- mujoco_warp_pbr-0.1.0/tests/test_kernel_cache.py +120 -0
- mujoco_warp_pbr-0.1.0/tests/test_material.py +73 -0
- mujoco_warp_pbr-0.1.0/tests/test_mesh_bvh.py +62 -0
- mujoco_warp_pbr-0.1.0/tests/test_optix.py +337 -0
- mujoco_warp_pbr-0.1.0/tests/test_optix_lifetime.py +199 -0
- mujoco_warp_pbr-0.1.0/tests/test_pathtrace.py +115 -0
- mujoco_warp_pbr-0.1.0/tests/test_render.py +300 -0
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mujoco-warp-pbr
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Batched physically based renderer for MuJoCo Warp
|
|
5
|
+
Author: Julien Blanchon
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Repository, https://github.com/julien-blanchon/mujoco_warp_pbr
|
|
8
|
+
Project-URL: Issues, https://github.com/julien-blanchon/mujoco_warp_pbr/issues
|
|
9
|
+
Keywords: mujoco,mujoco-warp,warp,rendering,pbr,ray-tracing,robotics,simulation
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Intended Audience :: Science/Research
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Topic :: Multimedia :: Graphics :: 3D Rendering
|
|
15
|
+
Classifier: Topic :: Scientific/Engineering
|
|
16
|
+
Classifier: Typing :: Typed
|
|
17
|
+
Requires-Python: >=3.12
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
License-File: LICENSE
|
|
20
|
+
Requires-Dist: mujoco>=3.13.0
|
|
21
|
+
Requires-Dist: mujoco-warp<3.18,>=3.16
|
|
22
|
+
Requires-Dist: numpy
|
|
23
|
+
Requires-Dist: warp-lang>=1.15
|
|
24
|
+
Provides-Extra: typing
|
|
25
|
+
Requires-Dist: mujoco-stubs>=3.13; extra == "typing"
|
|
26
|
+
Requires-Dist: pyrefly-numpy-stubs>=1.4; extra == "typing"
|
|
27
|
+
Requires-Dist: pyrefly-warp-stubs>=0.1; extra == "typing"
|
|
28
|
+
Provides-Extra: dev
|
|
29
|
+
Requires-Dist: mujoco-warp-pbr[typing]; extra == "dev"
|
|
30
|
+
Requires-Dist: pillow; extra == "dev"
|
|
31
|
+
Requires-Dist: pre-commit; extra == "dev"
|
|
32
|
+
Requires-Dist: pyrefly>=1.4; extra == "dev"
|
|
33
|
+
Requires-Dist: pytest; extra == "dev"
|
|
34
|
+
Requires-Dist: pytest-xdist; extra == "dev"
|
|
35
|
+
Requires-Dist: ruff; extra == "dev"
|
|
36
|
+
Provides-Extra: bench
|
|
37
|
+
Requires-Dist: flip-evaluator; extra == "bench"
|
|
38
|
+
Requires-Dist: mitsuba; extra == "bench"
|
|
39
|
+
Requires-Dist: pillow; extra == "bench"
|
|
40
|
+
Requires-Dist: newton; extra == "bench"
|
|
41
|
+
Requires-Dist: pygltflib>=1.16.5; extra == "bench"
|
|
42
|
+
Requires-Dist: trimesh; extra == "bench"
|
|
43
|
+
Requires-Dist: usd-core; extra == "bench"
|
|
44
|
+
Dynamic: license-file
|
|
45
|
+
|
|
46
|
+
# mujoco_warp_pbr
|
|
47
|
+
|
|
48
|
+
A batched, physically based renderer for [MuJoCo Warp](https://github.com/google-deepmind/mujoco_warp),
|
|
49
|
+
written in [NVIDIA Warp](https://github.com/NVIDIA/warp). It renders thousands of MuJoCo Warp worlds
|
|
50
|
+
per launch with a single specialised megakernel, using MuJoCo's own material, texture and light
|
|
51
|
+
fields.
|
|
52
|
+
|
|
53
|
+
- **Real-time tier** (default): primary ray, ray-traced (soft) shadows, Filament's BRDF with
|
|
54
|
+
multiscatter energy compensation, split-sum image-based lighting from HDR environment maps,
|
|
55
|
+
normal / ORM / emissive / opacity maps with ray-cone mip selection, specular anti-aliasing,
|
|
56
|
+
in-kernel supersampling, MuJoCo reflectance (mirror ray) and alpha blending. Deterministic and
|
|
57
|
+
noise-free.
|
|
58
|
+
- **Path-traced tier**: unidirectional path tracing with next-event estimation and multiple
|
|
59
|
+
importance sampling (lights, environment, BSDF). Same BRDF, converges to Mitsuba 3. Optional
|
|
60
|
+
edge-avoiding à-trous denoiser (`denoise=True`) guided by first-hit albedo, normal and depth.
|
|
61
|
+
- Every material, light and environment parameter can vary per world (domain randomisation)
|
|
62
|
+
without recompiling. Depth and segmentation match MuJoCo Warp's renderer.
|
|
63
|
+
|
|
64
|
+
## Install
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
pip install mujoco-warp-pbr # Python >= 3.12; pulls mujoco, mujoco-warp and warp-lang
|
|
68
|
+
pip install newton-pbr # optional: the Newton camera sensor
|
|
69
|
+
pip install "mujoco-warp-pbr[typing]" # optional: shape-aware type stubs for Pyrefly
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Usage
|
|
73
|
+
|
|
74
|
+
```python
|
|
75
|
+
import mujoco
|
|
76
|
+
import mujoco_warp as mjw
|
|
77
|
+
import warp as wp
|
|
78
|
+
|
|
79
|
+
import mujoco_warp_pbr as mjpbr
|
|
80
|
+
|
|
81
|
+
mjm = mujoco.MjModel.from_xml_path("scene.xml")
|
|
82
|
+
mjd = mujoco.MjData(mjm)
|
|
83
|
+
m = mjw.put_model(mjm)
|
|
84
|
+
d = mjw.put_data(mjm, mjd, nworld=1024)
|
|
85
|
+
|
|
86
|
+
rc = mjpbr.create_render_context(
|
|
87
|
+
mjm,
|
|
88
|
+
nworld=1024,
|
|
89
|
+
cam_res=(128, 128),
|
|
90
|
+
render_rgb=True,
|
|
91
|
+
render_depth=True,
|
|
92
|
+
envmap="studio.hdr", # optional equirectangular HDR environment
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
mjw.step(m, d)
|
|
96
|
+
mjw.refit_bvh(m, d, rc.base) # after the geometry moved
|
|
97
|
+
mjpbr.render(m, d, rc)
|
|
98
|
+
|
|
99
|
+
rgb = wp.zeros((1024, 128, 128), dtype=wp.vec3)
|
|
100
|
+
mjpbr.get_rgb(rc, 0, rgb) # camera 0, display RGB in [0, 1]
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Per-world variation: replace any batched array of the context or model with one whose leading
|
|
104
|
+
dimension is `nworld`, e.g. `rc.geom_roughness = wp.array(r, dtype=float)` with `r` of shape
|
|
105
|
+
`(nworld, ngeom)`, `rc.env_id` to select one of several environment maps per world, or
|
|
106
|
+
`m.geom_rgba` (MuJoCo Warp's convention: arrays are indexed with `worldid % shape[0]`).
|
|
107
|
+
|
|
108
|
+
On GPUs with RT cores, `traversal="optix"` traces the real-time tier's rays with OptiX instead of
|
|
109
|
+
Warp's software BVHs: 3–7× faster on mesh scenes, at most 1.3× on primitive-only scenes (and
|
|
110
|
+
slower with a mirror floor); `traversal="auto"` picks OptiX only when meshes are rendered. It needs
|
|
111
|
+
PyOptiX
|
|
112
|
+
([otk-pyoptix](https://github.com/NVIDIA/otk-pyoptix), built against the OptiX version of the
|
|
113
|
+
driver) and the OptiX SDK headers (`OPTIX_INCLUDE_DIR`), and falls back to the software path with
|
|
114
|
+
a warning otherwise; see `results/rt_backend.md` for what it supports.
|
|
115
|
+
|
|
116
|
+
## Materials and lights
|
|
117
|
+
|
|
118
|
+
Only native MuJoCo fields are used, so existing MJCF works unchanged:
|
|
119
|
+
|
|
120
|
+
| MuJoCo | Renderer |
|
|
121
|
+
| --- | --- |
|
|
122
|
+
| `rgba`, texture layer `rgb` / `rgba` | base colour (linear) and alpha |
|
|
123
|
+
| `metallic`, `roughness` (-1 = unset) | metallic, perceptual roughness; unset: metallic 0, roughness 1 − `shininess` (or `unset_material=UnsetMaterial.HEURISTIC`, or `default_material=`) |
|
|
124
|
+
| `specular` | dielectric reflectance, F0 = 0.16 · specular² (0.5 → 0.04) |
|
|
125
|
+
| layers `orm`, `occlusion`, `roughness`, `metallic` | ambient occlusion, roughness and metallic maps (factor × texel) |
|
|
126
|
+
| layer `normal` | tangent-space normal map (glTF convention) |
|
|
127
|
+
| `emission`, layer `emissive` | emitted radiance (display-relative: 1 = full brightness) |
|
|
128
|
+
| layer `opacity` | alpha |
|
|
129
|
+
| `reflectance` | mirror reflection blended by reflectance |
|
|
130
|
+
| light `intensity` (lux / candela), `range`, `bulbradius`, `diffuse` | physical lights (`light_model=LightModel.PHYSICAL`, default); intensity 0 uses a calibrated fallback |
|
|
131
|
+
| light `attenuation`, `cutoff`, `exponent`, `ambient`, `specular` | MuJoCo's GL semantics (`light_model=LightModel.MUJOCO`) |
|
|
132
|
+
| skybox texture | environment lighting and background when no `envmap` is given |
|
|
133
|
+
|
|
134
|
+
`tools/gltf_to_mjcf.py` converts glTF 2.0 assets (metallic-roughness core) to MJCF with these
|
|
135
|
+
fields.
|
|
136
|
+
|
|
137
|
+
Supported geometry: planes, spheres, capsules, ellipsoids, cylinders, boxes, meshes, height fields
|
|
138
|
+
and SDFs with full PBR; flex is shaded without normal maps and Gaussian splats keep MuJoCo Warp's
|
|
139
|
+
unlit compositing (a warning is printed for both).
|
|
140
|
+
|
|
141
|
+
## Newton
|
|
142
|
+
|
|
143
|
+
[`newton-pbr/`](https://github.com/julien-blanchon/mujoco_warp_pbr/blob/main/newton-pbr/README.md) is a small package depending on this one and on
|
|
144
|
+
[Newton](https://github.com/newton-physics/newton). Its `newton_pbr.SensorPbrCamera` mirrors
|
|
145
|
+
`newton.sensors.SensorCamera.update`, so any Newton scene renders with this renderer, batched over
|
|
146
|
+
all worlds:
|
|
147
|
+
|
|
148
|
+
```python
|
|
149
|
+
camera = newton_pbr.SensorPbrCamera(model, width=128, height=128, fovy=60.0, envmap="studio.hdr")
|
|
150
|
+
camera.update(state, camera_transforms, color_image=color, depth_image=depth)
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## Performance
|
|
154
|
+
|
|
155
|
+
Camera-frames per second, 4096 worlds at 64², one camera per world, HDR environment and shadows
|
|
156
|
+
for this renderer (RTX PRO 6000 Blackwell; from `benchmarks/suite.py`, full tables for three GPUs
|
|
157
|
+
and all renderers in [`results/suite/suite-v2`](https://github.com/julien-blanchon/mujoco_warp_pbr/blob/main/results/suite/suite-v2/README.md)):
|
|
158
|
+
|
|
159
|
+
| scene | real-time | real-time (OptiX) | Newton `SensorCamera` | Newton RTX (tiled) | MuJoCo Warp |
|
|
160
|
+
| --- | ---: | ---: | ---: | ---: | ---: |
|
|
161
|
+
| DamagedHelmet | 312k | **1.61M** | 168k | 71k | 112k |
|
|
162
|
+
| ABeautifulGame (1.5M triangles) | 246k | **1.33M** | 134k | 65k | 147k |
|
|
163
|
+
| ANYmal C | 180k | **926k** | 176k | 73k | 82k |
|
|
164
|
+
| Franka showroom (authored lights) | 226k | **795k** | 285k | 72k | 78k |
|
|
165
|
+
| material grid (spheres) | 1.87M | 2.39M | 1.95M | 73k | **2.54M** |
|
|
166
|
+
| primitives | 1.22M | 1.05M | 1.88M | 73k | **2.08M** |
|
|
167
|
+
|
|
168
|
+
- Newton's `SensorCamera` and MuJoCo Warp shade with albedo and simple lights (Newton's MJCF
|
|
169
|
+
import also drops the scenes' lights and textures); this renderer runs full PBR with
|
|
170
|
+
image-based lighting.
|
|
171
|
+
- On primitive-only scenes it runs at 0.6–0.7× MuJoCo Warp's speed, where PBR shading outweighs
|
|
172
|
+
traversal.
|
|
173
|
+
- Across GPUs (geometric mean over the suite's scenes, 4096 × 64², real-time tier without
|
|
174
|
+
OptiX): RTX PRO 6000 418k, H200 167k, A100 115k frames/s.
|
|
175
|
+
- Single-camera renderers for reference (frames/s, 256², DamagedHelmet): MuJoCo's OpenGL
|
|
176
|
+
renderer 4.4k, Newton's `ViewerRTX` 91, Mitsuba 3 at 16 spp 218, this renderer's path-traced
|
|
177
|
+
tier at 16 spp 82 (5.0k real-time; measured before the path tier applied `max_registers`, which
|
|
178
|
+
made it about 2× faster). Batched through one tiled render product (the "Newton RTX
|
|
179
|
+
(tiled)" column, static scenes only, `research/web/ovrtx_batching.md`), Omniverse RTX runs at
|
|
180
|
+
about 70k frames/s whatever the scene.
|
|
181
|
+
- Throughput saturates from about 1–4 M pixels per launch (e.g. 256 worlds at 64²).
|
|
182
|
+
|
|
183
|
+

|
|
184
|
+
|
|
185
|
+
Left to right: MuJoCo OpenGL, MuJoCo Warp, Newton `SensorCamera`, Newton `ViewerRTX`, this
|
|
186
|
+
renderer's real-time tier, its path-traced tier (256 spp) and Mitsuba 3 (256 spp).
|
|
187
|
+
|
|
188
|
+
See `results/scaling.md` and the milestone logs in [`results/history/`](https://github.com/julien-blanchon/mujoco_warp_pbr/blob/main/results/history/README.md)
|
|
189
|
+
(`m5_baseline.md`, `m7_autoresearch.md`) for more tables, `results/history/m6_pathtrace.md` for the
|
|
190
|
+
path-traced tier and `results/rt_backend.md` for the OptiX backend.
|
|
191
|
+
|
|
192
|
+
Tuning knobs: `max_registers` (96 by default, tuned on Hopper; 0 leaves it to the compiler; both
|
|
193
|
+
tiers apply it), `render_order` (`RenderOrder.TILED` default; `RenderOrder.WORLD` is up to 2.7×
|
|
194
|
+
faster when all worlds render nearly the same image, e.g. fixed cameras), `block_dim`,
|
|
195
|
+
`samples_per_pixel`, `shadow_samples`, and disabling unused features (`use_shadows`,
|
|
196
|
+
`use_textures`, `specular_aa`, `enable_reflections`). The host side of a `render()` call takes
|
|
197
|
+
about 61 µs (was 136 µs).
|
|
198
|
+
|
|
199
|
+
Settings are compiled into the kernel only where reading them at runtime measured slower
|
|
200
|
+
(DamagedHelmet and the material grid, 4096 worlds at 64², RTX PRO 6000):
|
|
201
|
+
|
|
202
|
+
| compiled-in setting | why | measured runtime cost |
|
|
203
|
+
| --- | --- | ---: |
|
|
204
|
+
| `samples_per_pixel` | sample loop | 4–20% |
|
|
205
|
+
| translucency (`max_layers`) | layer loop | 2–10% |
|
|
206
|
+
| reflections, textures, environment map, light model, denoise | code paths | 2–6% |
|
|
207
|
+
| light count, `render_order` | unrolled loop / pixel mapping | 1–4% |
|
|
208
|
+
| tier, geom types, traversal, fast math, `max_registers` | structural | – |
|
|
209
|
+
|
|
210
|
+
Changing one of these recompiles the kernel at the next render (about 2–7 s on GPU, 2 s on CPU);
|
|
211
|
+
every other setting (tone mapper, shadows and shadow samples, headlight, clip planes, HDR output,
|
|
212
|
+
environment background, specular AA, vertex normals, spot lights, …) is read at runtime.
|
|
213
|
+
|
|
214
|
+
## Running on CPU
|
|
215
|
+
|
|
216
|
+
No GPU is needed: the renderer runs unchanged on Warp's CPU device, with images within 1/255 of
|
|
217
|
+
the GPU's for the real-time tier.
|
|
218
|
+
|
|
219
|
+
```python
|
|
220
|
+
with wp.ScopedDevice("cpu"):
|
|
221
|
+
m = mjw.put_model(mjm)
|
|
222
|
+
d = mjw.put_data(mjm, mjd, nworld=16)
|
|
223
|
+
rc = mjpbr.create_render_context(mjm, nworld=16, cam_res=(64, 64), render_rgb=True)
|
|
224
|
+
mjpbr.render(m, d, rc)
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
Warp runs a CPU launch on a single core, so throughput does not grow with `nworld`. To use every
|
|
228
|
+
core, give each core its own worker, with its own `Data` and render context: Python threads
|
|
229
|
+
(Warp's launch releases the GIL) or pinned processes. `benchmarks/cpu_bench.py` measures this,
|
|
230
|
+
plus MuJoCo's OpenGL renderer on a software rasteriser and Mitsuba 3's LLVM backend:
|
|
231
|
+
|
|
232
|
+
```bash
|
|
233
|
+
python benchmarks/cpu_bench.py --scene damaged_helmet --res 64 --nworld 32 --workers 1 8 32 [--mode process]
|
|
234
|
+
python benchmarks/cpu_bench.py --parity --scene damaged_helmet --res 64 # CPU vs GPU images
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
DamagedHelmet at 64² renders at about 125–150 frames/s per core, scaling to 2.5k frames/s on a
|
|
238
|
+
16-core / 32-thread EPYC and 34k on a GH200 node (4× 72-core Grace). One GH200 GPU is 6–47×
|
|
239
|
+
faster than one 72-core Grace. A render context with an HDR environment takes about 2 s to
|
|
240
|
+
create on the CPU device (the map's prefilter runs in row bands on up to 16 threads; it took
|
|
241
|
+
about 32–35 s on one core). Full tables, the scaling curve and the baselines
|
|
242
|
+
are in [`results/cpu.md`](https://github.com/julien-blanchon/mujoco_warp_pbr/blob/main/results/cpu.md).
|
|
243
|
+
|
|
244
|
+
## Benchmarks and validation
|
|
245
|
+
|
|
246
|
+
```bash
|
|
247
|
+
python tools/fetch_assets.py # Khronos glTF, Menagerie robots, Poly Haven HDRIs
|
|
248
|
+
python benchmarks/bench.py --scene damaged_helmet --nworld 4096 --res 64
|
|
249
|
+
python benchmarks/bench.py --scene damaged_helmet --nworld 4096 --res 64 --gpus 0 1 2 3 # multi-GPU scaling
|
|
250
|
+
python benchmarks/sweep.py --preset score --out results/score.jsonl # also: scaling, tune
|
|
251
|
+
python benchmarks/validate.py --res 256 --spp 1024 # FLIP / PSNR against Mitsuba 3
|
|
252
|
+
python benchmarks/denoise_eval.py --scene grid_env --samples 4 16 # FLIP of the denoiser
|
|
253
|
+
python benchmarks/gallery.py --scene franka_showroom --frames 48 # side-by-side orbit video
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
Assets are cached in `$MJPBR_ASSET_DIR` (default `~/.cache/mujoco_warp_pbr`); `--set
|
|
257
|
+
envmap=hdri/<file>.hdr` and the other scripts resolve relative environment maps against it. The
|
|
258
|
+
reference renderers (Mitsuba 3, Newton) and image metrics install with the `bench` extra.
|
|
259
|
+
`benchmarks/cpu_bench.py` is the CPU counterpart of `bench.py` (see Running on CPU).
|
|
260
|
+
|
|
261
|
+
`benchmarks/suite.py` compares every renderer:
|
|
262
|
+
- this renderer: real-time tier, path-traced tier, and through `newton_pbr`;
|
|
263
|
+
- MuJoCo Warp, MuJoCo's OpenGL renderer and Mitsuba 3;
|
|
264
|
+
- Newton's `SensorCamera` and `ViewerRTX` (NVIDIA Omniverse RTX, on RTX GPUs).
|
|
265
|
+
|
|
266
|
+
It runs them on showcase, robotics and light-rig scenes, for a single scene and for batches, and
|
|
267
|
+
writes a markdown report with orbit videos. `tools/hf/run_suite.py` runs it on several
|
|
268
|
+
[Hugging Face Jobs](https://huggingface.co/docs/huggingface_hub/guides/jobs) GPUs, with a private
|
|
269
|
+
bucket carrying code, assets and results:
|
|
270
|
+
|
|
271
|
+
```bash
|
|
272
|
+
uv run tools/hf/run_suite.py --bucket USER/BUCKET --flavors rtx-pro-6000 h200 a100-large --sync-assets --wait
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
## Development
|
|
276
|
+
|
|
277
|
+
```bash
|
|
278
|
+
uv sync --all-extras
|
|
279
|
+
uv run pytest
|
|
280
|
+
uv run pytest -m "not slow" # skips the high-sample path-traced references
|
|
281
|
+
uv run ruff check . && uv run ruff format --check . # or: pre-commit install
|
|
282
|
+
uv run pyrefly check
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
**Type checking.** [Pyrefly](https://pyrefly.org/en/docs/tensor-shapes/) is the type checker. The `dev` extra
|
|
286
|
+
pulls in Pyrefly and the `typing` extra (`pip install mujoco-warp-pbr[typing]`): shape-aware stubs for Warp
|
|
287
|
+
(`pyrefly-warp-stubs`) and NumPy (`pyrefly-numpy-stubs`), and `mujoco-stubs`. Host code annotates array shapes
|
|
288
|
+
with named dimensions, e.g. `wp.array[wp.vec3, [NWorld, H, W]]` or `np.ndarray[[H, W, 3], np.dtype[np.float32]]`,
|
|
289
|
+
so image sizes, batch and channel counts are checked across calls; kernel signatures stay plain Warp
|
|
290
|
+
(`wp.array2d[float]`). The annotations are type-checking-only (`from __future__ import annotations`), so a plain
|
|
291
|
+
install needs neither Pyrefly nor the stubs. `uv sync --extra dev` is enough for `pyrefly check`: the
|
|
292
|
+
benchmark-only packages (`bench` extra, OptiX, ovrtx, huggingface_hub) are listed in `ignore-missing-imports`, so
|
|
293
|
+
their imports are untyped when absent and checked when installed.
|
|
294
|
+
|
|
295
|
+
Design notes and literature: [`research/`](https://github.com/julien-blanchon/mujoco_warp_pbr/blob/main/research/README.md).
|