Shape Indices #1757
-
|
Hi y'all, I've got a question about the Shape Indices you can extract from AOV's (https://mitsuba.readthedocs.io/en/stable/src/generated/plugins_integrators.html). Is the ordering random or based on the order of shape definition in the xml files? It appears to be arbitrary, but I'm wondering if there's any way to associate it with the bsdf id or merge multiple shapes that belong to the same object? Here's an example of a procedurally-generated scene with a landscape (made from multiple duplicated and scaled meshes), I'd like to give all the landscape meshes the same shape id in post, but I'm not sure if that's feasible? They're all defined together, sequentially, but they don't appear to be grouped here. If necessary, I can render shape ids twice, once only with landscape and once without and composite them based on the depthmap... but I'd rather avoid that approach if possible. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
|
Hi @Disgruntoad The shape ID gets defined whenever the Another useful trick: shapes = scene.shapes()
for shape in shapes:
print(f"shape: {shape}")
print(f"id: {dr.reinterpret_array(mi.UInt32, mi.ShapePtr(shape))}\n")This way you can associate ID's to their string representation which usually holds the filename of the mesh. You can do the same trick for BSDFs too. |
Beta Was this translation helpful? Give feedback.

Hi @Disgruntoad
The shape ID gets defined whenever the
Shapeobject is instantiated. However, when using parallel scene loading the instantiation order is potentially very random. You can turn off parallel loading by passingparallel=Falsetomi.load_dict()/mi.load_file. With this change you should get consistent IDs.Another useful trick:
This way you can associate ID's to their string representation which usually holds the filename of the mesh. You can do the same trick for BSDFs too.
If you can build this mapping at runtime, without relying…