Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AssetObject class to add or remove SceneObjects from Scene #536

Open
wants to merge 55 commits into
base: main
Choose a base branch
from

Conversation

guillaume-larue
Copy link

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

  • Detailed description
  • Added references to issues and discussions
  • Added / modified documentation as needed
  • Added / modified unit tests as needed
  • Passes all tests
  • Lint the code
  • Performed a self review
  • Ensure you Signed-off the commits. Required to accept contributions!
  • Co-authored with someone? Add Co-authored-by: user@domain and ensure they signed off their commits too.

guillaume-larue and others added 30 commits March 27, 2024 17:20
…ject in a scene through scene .xml file manipulation.
move them, interaction with component objects and RT.
Start material cells.

Fix all .xml files from Sionna.
…s. Some fix are still necessary to pass all tests.
…ssetObject or a SceneObject is kept during scene reload. Reorganisation of all the asset related tests.
…ifying the radio_material of an asset or a scene object.
…cene class (using scene.get() or scene.objects), such that SceneObjects can be garbage collected when deleted from within the Scene class.
@SebastianCa
Copy link
Collaborator

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.

@Fedomer
Copy link

Fedomer commented Oct 19, 2024

This will be very important funtionality! What about the merge?

@Fedomer
Copy link

Fedomer commented Oct 21, 2024

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.

- Update the default (random) rgb property of a BSDF based on default (itu) material bsdf rgb from XML file (when it is only defined as a rgb tuple).
- Update the rgb property of the BSDF when the BSDF is constructed based on a simple XML element containing only a rgb tuple.
…list, when items list contains AssetObject already present in the scene (i.e. which trigger a scene.remove() call).

Signed-off-by: guillaume-larue <[email protected]>
@guillaume-larue
Copy link
Author

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. 😃

@jhoydis
Copy link
Collaborator

jhoydis commented Oct 22, 2024

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.

@guillaume-larue
Copy link
Author

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.

@jhoydis
Copy link
Collaborator

jhoydis commented Nov 13, 2024

Hi @guillaume-larue,

That's great to hear. Please be patient :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants