Import 3D Models

Load scenes from Mitsuba XML files or import from Sionna RT

Overview#

WiTwin Channel supports two ways to load a scene from an external source:

  • Mitsuba XML — load a .xml scene file directly via Scene.load_mitsuba()
  • Sionna RT — import an existing sionna.rt.Scene object via Scene.from_sionna()

Both methods return a fully constructed Scene ready for simulation.

Load from a Mitsuba XML File#

import witwin.channel as wc
 
scene = wc.Scene.load_mitsuba(
    "path/to/scene.xml",
    frequency=3.5e9,
    device="cuda",
)

This loads the Mitsuba scene file, converts all shapes to Structure objects with their materials, and returns a Scene.

Note

Scene.load_mitsuba() requires Sionna RT to be installed, as it uses sionna.rt.load_scene() internally to parse the Mitsuba XML format.

Options#

ParameterDefaultDescription
frequencyNoneScene carrier frequency in Hz
device"cuda"PyTorch device string
merge_shapesTrueMerge shapes with the same material
remove_duplicate_verticesFalseDeduplicate vertices on load
vertical_ratio0.7Edge selection vertical ratio
edge_selection_mode"vertical_only"Edge policy mode

Import from Sionna RT#

If you already have a sionna.rt.Scene object, import it directly:

import sionna.rt as rt
import witwin.channel as wc
 
sionna_scene = rt.load_scene("path/to/scene.xml")
sionna_scene.frequency = 3.5e9
 
scene = wc.Scene.from_sionna(sionna_scene, device="cuda")

All scene objects, materials, and antenna arrays are converted automatically. Material properties (eps_r, sigma_e) are preserved from the Sionna radio materials.

Export to Sionna RT#

You can also go the other direction — export a WiTwin Channel scene back to Sionna RT:

sionna_scene = scene.to_sionna()

Warning

Sionna RT assumes mu_r=1.0 for all materials. If any structure in your scene uses a different mu_r, the export will raise an error. Pass strict_mu_r=False to skip this check.

Next Steps#