Commit f547744
authored
Propagate Newton shape colors before cloning (isaac-sim#6194)
# Description
This PR integrates @ooctipus's proposed fix for newton shape color
replacement to occur pre-clone. Original PR:
rilei-nvidia#1
Replace the post-finalize `replace_newton_shape_colors` pass on the
Newton model with `replace_newton_builder_shape_colors`, applied to each
ModelBuilder before clone replication. This ensures all cloned
environments automatically inherit the correct USD material and
displayColor values. This not only improves performance but also
addresses the regression that @huidongc discovered last week where only
env_0 (the clone source) had the right color for the robot arm, and the
other cloned envs got the fallback colors
- Add replace_newton_builder_shape_colors to newton_model_utils.
- Removed replace_newton_shape_colors and any un-used functionality
- Call it in NewtonManager (flat, env, and proto-source builders),
newton_clone_utils, and replicate
- Update tests to exercise the new replace_newton_builder_shape_colors
- Update dexsuite_kuka_hetero golden images for correctness
# Validation
Validated for correctness in the Newton visualizer with (all robot arms
should have the same color):
```bash
./isaaclab.sh train --rl_library rsl_rl \
--task Isaac-Lift-KukaAllegro-Camera \
presets=newton_mjwarp,newton_renderer,rgb64,single_camera \
--seed 42 \
--num_envs 4 \
--max_iterations 2 \
--visualizer newton
```
<img width="1917" height="1159" alt="image"
src="https://github.com/user-attachments/assets/fabf9ef4-60f6-4e29-a11a-e266e77d7f61"
/>
Rendering test golden images for the dexsuite_kuka_hetero kitless suite
have also been updated to reflect fix to the regression
```bash
./isaaclab.sh -p -m pytest -v -rA source/isaaclab_tasks/test/core/test_rendering_dexsuite_kuka_hetero_kitless.py::test_rendering_dexsuite_kuka_hetero_kitless[newton-newton_warp-rgb]
```
<img width="742" height="1046" alt="image"
src="https://github.com/user-attachments/assets/6e357b06-5cf2-458f-886b-4b283952c94f"
/>
# Performance
Testing on a AMD Ryzen Threadripper PRO 7965WX 24-Cores (48) @ 5.36 GHz
For testing the performance impact I used the benchmark script:
```bash
./isaaclab.sh -p scripts/benchmarks/benchmark_non_rl.py \
--task Isaac-Lift-KukaAllegro-Camera \
presets=newton_mjwarp,ovrtx_renderer,rgb64,single_camera \
--seed 42 \
--num_envs "8000" \
--benchmark_backend json \
--output_path "hdc/benchmarks/20260611/heterogeneous_8000"
```
The time of replace_newton_shape_colors has been moved to calls to the
new replace_newton_builder_shape_colors pre-clone:
| # Env | replace_newton_shape_colors (Before) |
replace_newton_builder_shape_colors (After) |
| ------ | ----- | ----- |
| 4000 | 2 s | 0.0045~ s|
| 8000 | 4 s | 0.0045~ s|
With @ooctipus's change the time for shape color propagation is not only
"free" now, but constant to increasing # of environments.
## Checklist
- [x] I have read and understood the [contribution
guidelines](https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html)
- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./isaaclab.sh --format`
- [x] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective or that my
feature works
- [x] I have updated the changelog and the corresponding version in the
extension's `config/extension.toml` file
- [x] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there1 parent 832a356 commit f547744
11 files changed
Lines changed: 164 additions & 288 deletions
File tree
- source
- isaaclab_newton
- changelog.d
- isaaclab_newton
- cloner
- physics
- isaaclab_tasks
- changelog.d
- test/golden_images/dexsuite_kuka_hetero
- isaaclab
- changelog.d
- isaaclab/sim/utils
- test/sim
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
Lines changed: 42 additions & 121 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
17 | 16 | | |
18 | 17 | | |
19 | 18 | | |
| |||
22 | 21 | | |
23 | 22 | | |
24 | 23 | | |
25 | | - | |
| 24 | + | |
26 | 25 | | |
27 | 26 | | |
28 | 27 | | |
| |||
36 | 35 | | |
37 | 36 | | |
38 | 37 | | |
39 | | - | |
40 | | - | |
41 | | - | |
| 38 | + | |
| 39 | + | |
42 | 40 | | |
43 | 41 | | |
44 | 42 | | |
45 | 43 | | |
46 | 44 | | |
47 | 45 | | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
| 46 | + | |
72 | 47 | | |
73 | 48 | | |
74 | 49 | | |
| |||
203 | 178 | | |
204 | 179 | | |
205 | 180 | | |
206 | | - | |
| 181 | + | |
207 | 182 | | |
208 | 183 | | |
209 | 184 | | |
| |||
231 | 206 | | |
232 | 207 | | |
233 | 208 | | |
234 | | - | |
235 | | - | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
236 | 213 | | |
237 | | - | |
238 | | - | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
239 | 221 | | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | | - | |
| 222 | + | |
246 | 223 | | |
247 | 224 | | |
248 | | - | |
249 | | - | |
250 | | - | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
251 | 228 | | |
252 | 229 | | |
253 | 230 | | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
263 | | - | |
264 | | - | |
265 | 231 | | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | | - | |
270 | | - | |
271 | 232 | | |
272 | 233 | | |
273 | 234 | | |
274 | 235 | | |
275 | 236 | | |
276 | 237 | | |
277 | 238 | | |
278 | | - | |
279 | | - | |
| 239 | + | |
| 240 | + | |
280 | 241 | | |
281 | 242 | | |
282 | 243 | | |
283 | 244 | | |
284 | 245 | | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
| 246 | + | |
| 247 | + | |
292 | 248 | | |
293 | 249 | | |
294 | | - | |
295 | | - | |
296 | | - | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
297 | 254 | | |
298 | 255 | | |
299 | 256 | | |
300 | | - | |
301 | | - | |
302 | | - | |
303 | | - | |
304 | | - | |
305 | | - | |
306 | | - | |
307 | | - | |
308 | | - | |
309 | | - | |
310 | | - | |
311 | | - | |
312 | | - | |
313 | | - | |
314 | | - | |
315 | | - | |
316 | | - | |
317 | | - | |
318 | | - | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
319 | 261 | | |
320 | | - | |
321 | | - | |
322 | | - | |
323 | | - | |
324 | | - | |
325 | | - | |
326 | | - | |
327 | | - | |
328 | | - | |
329 | | - | |
330 | | - | |
331 | | - | |
332 | | - | |
333 | | - | |
334 | | - | |
335 | | - | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
336 | 270 | | |
337 | 271 | | |
338 | | - | |
339 | | - | |
340 | | - | |
341 | | - | |
342 | | - | |
343 | | - | |
344 | | - | |
345 | | - | |
346 | | - | |
347 | | - | |
348 | | - | |
349 | | - | |
350 | | - | |
351 | | - | |
352 | | - | |
| 272 | + | |
| 273 | + | |
Lines changed: 0 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
103 | | - | |
104 | 103 | | |
105 | 104 | | |
106 | 105 | | |
| |||
155 | 154 | | |
156 | 155 | | |
157 | 156 | | |
158 | | - | |
159 | 157 | | |
160 | 158 | | |
161 | 159 | | |
| |||
0 commit comments