mitsuba-renderer / mitsuba2

Mitsuba 2: A Retargetable Forward and Inverse Renderer
Other
2.05k stars 266 forks source link

Editing scene object structure - [❔ other question] #603

Open anderslanglands opened 2 years ago

anderslanglands commented 2 years ago

I'm trying to write a USD Hydra delegate for Mitsuba. In order to do so I need to be able to change the scene structure, e.g. to assign a new BSDF to a Shape. This doesn't appear to be possible with the current API - one can change the value of many parameters using the TraversalCallback API but not assign new Objects.

Would it be possible to modify Mitsuba to do this? Or is the current architecture fundamentally antithetical to changing the structure of the scene graph after the scene is first created?

anderslanglands commented 2 years ago

Thinking about it some more, it occurs to me that a possible solution might be to create and hold ref's to all the objects individually, then construct the scene graph fresh each time the topology changes. I'll give that a go.

Speierers commented 2 years ago

Indeed this isn't something we support at this point.

We will look into the ability to modify the scene graph on the fly eventually but this isn't high priority on our todo list.

Your alternative solution should work as well, although might be less efficient (e.g. rebuilding the BVH when setting a new BSDF)