AssetObject class to add or remove SceneObjects from Scene
Description
Related to discussion 512
The present pull request enables the addition and removal of (group of) SceneObjects in the current scene. These objects, named assets, are handled by a dedicated new class, AssetObject. They are described in the same way a scene is described, i.e., from a Blender Mitsuba Export .xml file and a set of .ply meshes. Hence, new asset objects can be created using Blender.
The addition and removal of assets are straightforward. AssetObject basically offers the same API properties as SceneObject, including position, orientation, velocity, and radio_materials. Assets can interact with ray tracing, as they are basically composed of SceneObjects, hence relying on legacy features of Sionna.
The pull request also proposes an improved way to manage the rendering of RadioMaterial. Thanks to the BSDF class, it is now possible to easily manipulate and update the way a RadioMaterial of the scene is rendered.
A novel Jupyter Notebook named Sionna_Ray_Tracing_Asset.ipynb is added to explain in detail how to use these features, and the documentation of the asset-related classes has been updated.
New APIs for the added AssetObjects functionalities have been provided. No changes in legacy APIs, except for SceneObjects referenced outside the Scene class, which are now weak-referenced to avoid remaining strong references to removed SceneObjects (when accessing scene.objects property or calling scene.get("scene_object_name")).
We have noticed the demands for signed-off commits only when preparing the Pull Request. Since the change in the git history would be quite significant, is this absolutely mandatory to do it on all the commits, or would a single signed-off commit be sufficient for the complete pull request (as provided here)?
Co-authored-by: [email protected]
Checklist
- [x] Detailed description
- [x] Added references to issues and discussions
- [x] Added / modified documentation as needed
- [x] Added / modified unit tests as needed
- [x] Passes all tests
- [x] Lint the code
- [x] Performed a self review
- [ ] Ensure you Signed-off the commits. Required to accept contributions!
- [x] Co-authored with someone? Add
Co-authored-by: user@domainand ensure they signed off their commits too.
Hi @guillaume-larue, Thank you for the PR! We’ll review it carefully and get back to you, but please note that it might take a few weeks due to vacation time.
This will be very important funtionality! What about the merge?
Hello Sionnateams and Mr @guillaume-larue thank for your effort
Sorry but if you create a shape like this in mitsuba it works but:
import mitsuba as mi
# Inizializza Mitsuba con il plugin corretto
mi.set_variant('scalar_rgb')
# Definizione di un cubo come shape Mitsuba
mi_shape = mi.load_dict({
"type": "cube", # Tipo di forma Mitsuba
"to_world": mi.ScalarTransform4f.translate([0, 0, 0]) @ mi.ScalarTransform4f.scale([5, 2, 1.5]) # Set Dimension
})
car = sionna.rt.SceneObject(name="Car01",
object_id='car01',
mi_shape = mi_shape
)
scene.add(car)
it seems that the creation of the object was blocked in v 0.19 by a control.
is it possible to just have at first just a basic type of element like a box (usefull for car, truck or why not human):
myBox1 = Scene.Box(name,position,orientation,scale,material,color)
scene.add(myBox1)
Step 2 - Load Object
Why not have function like LoadObject(file=XMLFile) for a type sionna.rt.SceneObject and the you can add at a scene any object exported in mitsuba file.
Thank you for your comments and suggestions, @Fedomer!
Regarding adding objects directly with SceneObject(mi_shape), this wouldn't, to my understanding, update important elements like path and coverage map solvers, which could lead to inaccurate radio simulations (can you confirm, @SebastianCa?). That's why we defined the scene.reload() method, which is typically used when adding AssetObjects.
Your suggestion about loading objects from XML files is in a sense similar to how AssetObjects work:
- The asset is defined based on an XML file.
- It's added to the scene with scene.add()
Yet, the AssetObject approach allows for simple manipulations, particularly for complex objects composed of multiple shapes. For example, rotating around a common center is much easier with AssetObjects than with independent SceneObjects (which would be the case when importing an XML file containing multiple shapes).
@SebastianCa @jhoydis - Congratulations on the new Sionna v0.19 release! Do you have any updates on this PR? I have added a few small commits to fix some minor bugs. @Inv4lidn4m3 and I are available to discuss or clarify anything if needed. 😃
Hi @guillaume-larue,
Thanks again for this PR. We are currently implementing some very significant changes in the Sionna RT module and cannot merge your PR for now.
Hi @jhoydis,
Thank you for the update on the PR status. I understand that significant changes are currently being implemented in the Sionna RT module, which prevents merging at this time.
For your information, we've had the opportunity to present these features to partners in a European project. It raised substantial interest. We thought this might be useful context as you plan future developments.
I'm available to discuss or update the PR whenever it aligns with your development timeline.
Hi @guillaume-larue,
That's great to hear. Please be patient :-)
PR is up to date with 0.19.1