Scene Objects
A scene is made of scene objects. Examples include cars, trees,
buildings, furniture, etc.
A scene object is characterized by its geometry and material (RadioMaterial
)
and implemented as an instance of the SceneObject
class.
Scene objects are uniquely identified by their name.
To access a scene object, the get()
method of
Scene
may be used.
For example, the following code snippet shows how to load a scene and list its scene objects:
scene = load_scene(sionna.rt.scene.munich)
print(scene.objects)
To select an object, e.g., named “Schrannenhalle-itu_metal”, you can run:
my_object = scene.get("Schrannenhalle-itu_metal")
You can then set the RadioMaterial
of my_object
as follows:
my_object.radio_material = "itu_wood"
- class sionna.rt.SceneObject(mi_mesh=None, name=None, fname=None, radio_material=None)[source]
Class implementing a scene object
Scene objects can be either created from an existing Mitsuba shape or by loading a mesh from a file. In the latter case, a name and radio material for the scene object must be provided.
To create a scene object from a mesh file, use the following approach:
obj = SceneObject(fname=sionna.rt.scene.sphere, name="sphere", radio_material=ITURadioMaterial(name="sphere-material", itu_type="metal", thickness=0.01))
To instantiate a scene object using a Mitsuba shape, follow these steps:
mesh = load_mesh(sionna.rt.scene.sphere) obj = SceneObject(mi_mesh=mesh, name="sphere", radio_material=ITURadioMaterial(name="sphere-material", itu_type="metal", thickness=0.01))
- Parameters:
mi_mesh (
typing.Optional
[mitsuba.Mesh
]) – Mitsuba shape. Must be provided iffname
isNone
.name (
typing.Optional
[str
]) – Object name. Must be provided iffname
is notNone
.fname (
typing.Optional
[str
]) – Filename of a valid mesh ( “.ply” | “.obj”). Must be provided ifmi_mesh
isNone
.radio_material (
typing.Optional
[sionna.rt.radio_materials.radio_material_base.RadioMaterialBase
]) – Radio material of the object. Must be provided iffname
is notNone
.
- clone(name=None, as_mesh=False, props=None)[source]
Creates a clone of the current scene object
The clone will have the same geometry and material properties as the original object but will be assigned a new name.
- Parameters:
name (
typing.Optional
[str
]) – Name (id) of the cloned object. IfNone
, the clone will be named as<original_name>-clone
.as_mesh – If set to True, the clone will be returned as a
mitsuba.Mesh
object. Otherwise, asionna.rt.SceneObject
will be returned.props (
typing.Optional
[mitsuba.Properties
]) – Pre-populated properties to be used in the new Mitsuba shape. Allows overriding the BSDF, emitter, etc.
- Return type:
sionna.rt.scene_object.SceneObject
|mitsuba.Mesh
- Returns:
A clone of the current object
- look_at(target)[source]
Sets the orientation so that the x-axis points toward a position
- Parameters:
target (
mitsuba.Point3f
|sionna.rt.radio_devices.radio_device.RadioDevice
|str
) – A position or the name or instance of an object in the scene to point toward to
- property mi_mesh
Get/set the Mitsuba shape
- Type:
mi.Mesh
- property name
Name
- Type:
str
- property object_id
Identifier
- Type:
int
- property orientation
Get/set the orientation [rad] specified through three angles \((\alpha, \beta, \gamma)\) corresponding to a 3D rotation as defined in (3)
- Type:
mi.Point3f
- property position
Get/set the position vector [m] of the center of the object. The center is defined as the object’s axis-aligned bounding box (AABB).
- Type:
mi.Point3f
- property radio_material
Get/set the radio material of the object. Setting can be done by using either an instance of
RadioMaterialBase
or the material name (str
).- Type:
- property scaling
Get the scaling in the coordinate system of the object. If a scalar value is provided, the object is uniformly scaled across all dimensions by that value. Alternatively, if a vector is provided, the object is scaled independently along the x, y, and z axes according to the respective components of the vector, within the object’s coordinate system.
- Type:
mi.Float
|mi.Vector3f
- property scene
Get/set the scene to which the object belongs. Note that the scene can only be set once.
- Type:
- property velocity
Get/set the velocity vector [m/s]
- Type:
mi.Vector3f