Closed glopesr closed 5 months ago
It will occured due new api changes in Blender 4.0. Thats why try previous versions of Blender
Thank you. I installed a previous version of Blender. When exporting it seems it is fine. But when loading the scene, I have another error message:
RuntimeError: [xml.cpp:1079] Error while loading "ufmg_praca.xml" (near line 43, col 3): could not instantiate shape plugin of type "ply":
[xml.cpp:1079] [PLYMesh] Error while loading PLY file "Plane.ply": file not found!
I really can not understand what is going on when performing the xml export :(
As you can see need to remove exportted scene folder and try to re-export again
Regarding Blender 4.0, we have just made a new release of the exporter that should support it.
Regarding your importing issue, can you please share with us a reproducer so we can look into it? Also, when you say "loading the scene", do you mean that you are trying to import it again in blender using this add-on, or that you are trying to load it in python, using e.g. scene = mi.load_file("exported_scene.xml")
?
I am having the problem when loading the .xml in SionnaRT, on Jupyter Notebook.
Here it follows attached SionnaRT.zip ufmg_praca.zip the code and file:
The scene folder you shared only contains an XML file, and no external files that would be necessary, e.g. Meshes. This likely means your export was not successful. Please try exporting to a clean folder again.
Also, please let us know if the issue happens only with Mitsuba. We are not maintainers of the SionnaRT problem, nor are we familiar with it. If the export was successful, you should be able to render the scene using mitsuba in the CLI, e.g.:
mitsuba scene.xml
otherwise, you can check if the scene file is valid by importing it in mitsuba from python:
import mitsuba as mi
mi.set_variant("scalar_rgb")
scene = mi.load_file("<path to scene.xml>")
print(scene)
Please try either of these methods to check the validity of the exported file.
I forgot ro export the meshes folder. When perfomed what you askes, The results were:
Scene[
children = [
PathIntegrator[
max_depth = 12,
rr_depth = 5
],
ConstantBackgroundEmitter[
radiance = SRGBReflectanceSpectrum[
value = [1, 0.935082, 0.804393]
],
bsphere = BoundingSphere3f[
center = [-17.3643, 4.98451, 34.7953],
radius = 620.764
]
],
PLYMesh[
name = "Pra_a_de_Servi_os_da_UFMG-itu_concrete.ply",
bbox = BoundingBox3f[
min = [-365.826, 0, 181.158],
max = [-251.228, 14.8316, 294.47]
],
vertex_count = 50,
vertices = [600 B of vertex data],
face_count = 50,
faces = [600 B of face data],
face_normals = 1
],
PLYMesh[
name = "Pra_a_de_Servi_os_da_UFMG-itu_metal.ply",
bbox = BoundingBox3f[
min = [-365.826, 14.8316, 181.158],
max = [-251.228, 14.8316, 294.47]
],
vertex_count = 25,
vertices = [300 B of vertex data],
face_count = 23,
faces = [276 B of face data],
face_normals = 1
],
PLYMesh[
name = "Escola_de_M_sica-itu_concrete.ply",
bbox = BoundingBox3f[
min = [-142.623, 0, -311.032],
max = [-65.6817, 20.8596, -236.882]
],
vertex_count = 26,
vertices = [312 B of vertex data],
face_count = 26,
faces = [312 B of face data],
face_normals = 1
],
PLYMesh[
name = "Escola_de_M_sica-itu_metal.ply",
bbox = BoundingBox3f[
min = [-142.623, 20.8596, -311.032],
max = [-65.6817, 20.8596, -236.882]
],
vertex_count = 13,
vertices = [156 B of vertex data],
face_count = 11,
faces = [132 B of face data],
face_normals = 1
],
PLYMesh[
name = "Escola_de_Belas_Artes-itu_concrete.ply",
bbox = BoundingBox3f[
min = [194.092, 0, -320.75],
max = [248.032, 16.8941, -266.359]
],
vertex_count = 24,
vertices = [288 B of vertex data],
face_count = 24,
faces = [288 B of face data],
face_normals = 1
],
PLYMesh[
name = "Escola_de_Belas_Artes-itu_metal.ply",
bbox = BoundingBox3f[
min = [194.092, 16.8941, -320.75],
max = [248.032, 16.8941, -266.359]
],
vertex_count = 12,
vertices = [144 B of vertex data],
face_count = 10,
faces = [120 B of face data],
face_normals = 1
],
PLYMesh[
name = "Unidade_Municipal_de_Educa__o_Infantil_Ala_de_Lisboa-itu_concrete.ply",
bbox = BoundingBox3f[
min = [256.709, 0, -196.16],
max = [364.127, 21.1248, -107.103]
],
vertex_count = 24,
vertices = [288 B of vertex data],
face_count = 24,
faces = [288 B of face data],
face_normals = 1
],
PLYMesh[
name = "Unidade_Municipal_de_Educa__o_Infantil_Ala_de_Lisboa-itu_metal.ply",
bbox = BoundingBox3f[
min = [256.709, 21.1248, -196.16],
max = [364.127, 21.1248, -107.103]
],
vertex_count = 12,
vertices = [144 B of vertex data],
face_count = 10,
faces = [120 B of face data],
face_normals = 1
],
PLYMesh[
name = "Faculdade_de_Educa__o-itu_concrete.ply",
bbox = BoundingBox3f[
min = [268.249, 0, 239.958],
max = [438.847, 17.5801, 417.033]
],
vertex_count = 62,
vertices = [744 B of vertex data],
face_count = 62,
faces = [744 B of face data],
face_normals = 1
],
PLYMesh[
name = "Faculdade_de_Educa__o-itu_metal.ply",
bbox = BoundingBox3f[
min = [268.249, 17.5801, 239.958],
max = [438.847, 17.5801, 417.033]
],
vertex_count = 31,
vertices = [372 B of vertex data],
face_count = 29,
faces = [348 B of face data],
face_normals = 1
],
PLYMesh[
name = "Centro_Pedag_gico-itu_concrete.ply",
bbox = BoundingBox3f[
min = [284.27, 0, 116.939],
max = [377.93, 14.3014, 198.59]
],
vertex_count = 24,
vertices = [288 B of vertex data],
face_count = 24,
faces = [288 B of face data],
face_normals = 1
],
PLYMesh[
name = "Centro_Pedag_gico-itu_metal.ply",
bbox = BoundingBox3f[
min = [284.27, 14.3014, 116.939],
max = [377.93, 14.3014, 198.59]
],
vertex_count = 12,
vertices = [144 B of vertex data],
face_count = 10,
faces = [120 B of face data],
face_normals = 1
],
PLYMesh[
name = "Anexo_Belas_Artes-itu_concrete.ply",
bbox = BoundingBox3f[
min = [150.182, 0, -273.974],
max = [192.95, 15.949, -223.991]
],
vertex_count = 12,
vertices = [144 B of vertex data],
face_count = 12,
faces = [144 B of face data],
face_normals = 1
],
PLYMesh[
name = "Anexo_Belas_Artes-itu_metal.ply",
bbox = BoundingBox3f[
min = [150.182, 15.949, -273.974],
max = [192.95, 15.949, -223.991]
],
vertex_count = 6,
vertices = [72 B of vertex data],
face_count = 4,
faces = [48 B of face data],
face_normals = 1
],
PLYMesh[
name = "Departamento_de_Gest_o_Ambiental-itu_concrete.ply",
bbox = BoundingBox3f[
min = [117.517, 0, -363.018],
max = [172.106, 17.1515, -274.007]
],
vertex_count = 16,
vertices = [192 B of vertex data],
face_count = 16,
faces = [192 B of face data],
face_normals = 1
],
PLYMesh[
name = "Departamento_de_Gest_o_Ambiental-itu_metal.ply",
bbox = BoundingBox3f[
min = [117.517, 17.1515, -363.018],
max = [172.106, 17.1515, -274.007]
],
vertex_count = 8,
vertices = [96 B of vertex data],
face_count = 6,
faces = [72 B of face data],
face_normals = 1
],
PLYMesh[
name = "element-itu_concrete.ply",
bbox = BoundingBox3f[
min = [-336.344, 0, 237.597],
max = [-309.302, 16.5549, 264.67]
],
vertex_count = 52,
vertices = [624 B of vertex data],
face_count = 52,
faces = [624 B of face data],
face_normals = 1
],
PLYMesh[
name = "element-itu_metal.ply",
bbox = BoundingBox3f[
min = [-336.344, 16.5549, 237.597],
max = [-309.302, 16.5549, 264.67]
],
vertex_count = 26,
vertices = [312 B of vertex data],
face_count = 24,
faces = [288 B of face data],
face_normals = 1
],
PLYMesh[
name = "Rosa_dos_ventos_-_Instituto_de_Geo-ci_ncias_da_UFMG-itu_concrete.ply",
bbox = BoundingBox3f[
min = [-41.2546, 0, 281.232],
max = [-31.3192, 7.95362, 291.807]
],
vertex_count = 32,
vertices = [384 B of vertex data],
face_count = 32,
faces = [384 B of face data],
face_normals = 1
],
PLYMesh[
name = "Rosa_dos_ventos_-_Instituto_de_Geo-ci_ncias_da_UFMG-itu_metal.ply",
bbox = BoundingBox3f[
min = [-41.2546, 7.95362, 281.232],
max = [-31.3192, 7.95362, 291.807]
],
vertex_count = 16,
vertices = [192 B of vertex data],
face_count = 14,
faces = [168 B of face data],
face_normals = 1
],
PLYMesh[
name = "Edif_cio_Professor_Yvon_Leite_de_Magalh_es_Pinto-itu_metal.ply",
bbox = BoundingBox3f[
min = [-196.83, 19.6994, 133.689],
max = [-53.6821, 19.6994, 318.379]
],
vertex_count = 52,
vertices = [624 B of vertex data],
face_count = 64,
faces = [768 B of face data],
face_normals = 1
],
PLYMesh[
name = "Edif_cio_Professor_Yvon_Leite_de_Magalh_es_Pinto-itu_concrete.ply",
bbox = BoundingBox3f[
min = [-196.83, 0, 133.689],
max = [-53.6821, 19.6994, 318.379]
],
vertex_count = 104,
vertices = [1.22 KiB of vertex data],
face_count = 104,
faces = [1.22 KiB of face data],
face_normals = 1
],
PLYMesh[
name = "Centro_de_Atividades_Did_ticas_2-itu_metal.ply",
bbox = BoundingBox3f[
min = [184.174, 20.4793, -25.675],
max = [277.1, 20.4793, 98.2683]
],
vertex_count = 24,
vertices = [288 B of vertex data],
face_count = 24,
faces = [288 B of face data],
face_normals = 1
],
PLYMesh[
name = "Centro_de_Atividades_Did_ticas_2-itu_concrete.ply",
bbox = BoundingBox3f[
min = [184.174, 0, -25.675],
max = [277.1, 20.4793, 98.2683]
],
vertex_count = 48,
vertices = [576 B of vertex data],
face_count = 48,
faces = [576 B of face data],
face_normals = 1
],
PLYMesh[
name = "Editora_UFMG-itu_concrete.ply",
bbox = BoundingBox3f[
min = [219.769, 0, 95.9758],
max = [278.147, 21.0037, 111.037]
],
vertex_count = 8,
vertices = [96 B of vertex data],
face_count = 8,
faces = [96 B of face data],
face_normals = 1
],
PLYMesh[
name = "Editora_UFMG-itu_metal.ply",
bbox = BoundingBox3f[
min = [219.769, 21.0037, 95.9758],
max = [278.147, 21.0037, 111.037]
],
vertex_count = 4,
vertices = [48 B of vertex data],
face_count = 2,
faces = [24 B of face data],
face_normals = 1
],
PLYMesh[
name = "element_001-itu_metal.ply",
bbox = BoundingBox3f[
min = [-52.1642, 18.5213, 1.94215],
max = [205.332, 18.5213, 182.758]
],
vertex_count = 105,
vertices = [1.23 KiB of vertex data],
face_count = 129,
faces = [1.51 KiB of face data],
face_normals = 1
],
PLYMesh[
name = "element_001-itu_concrete.ply",
bbox = BoundingBox3f[
min = [-52.1642, 0, 1.94215],
max = [205.332, 18.5213, 182.758]
],
vertex_count = 210,
vertices = [2.46 KiB of vertex data],
face_count = 210,
faces = [2.46 KiB of face data],
face_normals = 1
],
PLYMesh[
name = "Reitoria-itu_metal.ply",
bbox = BoundingBox3f[
min = [-339.468, 23.8187, 0.362896],
max = [-221.728, 23.8187, 87.9835]
],
vertex_count = 12,
vertices = [144 B of vertex data],
face_count = 12,
faces = [144 B of face data],
face_normals = 1
],
PLYMesh[
name = "Reitoria-itu_concrete.ply",
bbox = BoundingBox3f[
min = [-339.468, 0, 0.362896],
max = [-221.728, 23.8187, 87.9835]
],
vertex_count = 24,
vertices = [288 B of vertex data],
face_count = 24,
faces = [288 B of face data],
face_normals = 1
],
PLYMesh[
name = "Instituto_de_Ci_ncias_Exatas-itu_metal.ply",
bbox = BoundingBox3f[
min = [-333.274, 13.8177, 290.506],
max = [-192.055, 13.8177, 407.648]
],
vertex_count = 38,
vertices = [456 B of vertex data],
face_count = 42,
faces = [504 B of face data],
face_normals = 1
],
PLYMesh[
name = "Instituto_de_Ci_ncias_Exatas-itu_concrete.ply",
bbox = BoundingBox3f[
min = [-333.274, 0, 290.506],
max = [-192.055, 13.8177, 407.648]
],
vertex_count = 76,
vertices = [912 B of vertex data],
face_count = 76,
faces = [912 B of face data],
face_normals = 1
],
PLYMesh[
name = "element_002-itu_metal.ply",
bbox = BoundingBox3f[
min = [-52.0693, 16.4204, 291.028],
max = [21.9382, 16.4204, 374.974]
],
vertex_count = 24,
vertices = [288 B of vertex data],
face_count = 28,
faces = [336 B of face data],
face_normals = 1
],
PLYMesh[
name = "element_002-itu_concrete.ply",
bbox = BoundingBox3f[
min = [-52.0693, 0, 291.028],
max = [21.9382, 16.4204, 374.974]
],
vertex_count = 48,
vertices = [576 B of vertex data],
face_count = 48,
faces = [576 B of face data],
face_normals = 1
],
PLYMesh[
name = "Biblioteca_Central-itu_concrete.ply",
bbox = BoundingBox3f[
min = [-427.189, 0, 109.247],
max = [-334.179, 17.6123, 211.304]
],
vertex_count = 36,
vertices = [432 B of vertex data],
face_count = 36,
faces = [432 B of face data],
face_normals = 1
],
PLYMesh[
name = "Biblioteca_Central-itu_metal.ply",
bbox = BoundingBox3f[
min = [-427.189, 17.6123, 109.247],
max = [-334.179, 17.6123, 211.304]
],
vertex_count = 18,
vertices = [216 B of vertex data],
face_count = 16,
faces = [192 B of face data],
face_normals = 1
],
PLYMesh[
name = "Plane.ply",
bbox = BoundingBox3f[
min = [-482.295, -13.8497, -376.013],
max = [447.566, -13.8497, 445.604]
],
vertex_count = 4,
vertices = [80 B of vertex data],
face_count = 2,
faces = [24 B of face data],
face_normals = 1
],
SmoothDiffuse[
reflectance = SRGBReflectanceSpectrum[
value = [1, 0.5, 0.2]
]
],
SmoothDiffuse[
reflectance = SRGBReflectanceSpectrum[
value = [0.29, 0.25, 0.21]
]
]
]
]
But when I tried again to perform the same action on SionaRT now I received another error message:
Code:
# Load integrated scene
scene = load_scene("ufmg_praca.xml")
scene.preview
Result:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[29], line 2
1 # Load integrated scene
----> 2 scene = load_scene("ufmg_praca.xml")
3 scene.preview
File D:\Users\glauc\anaconda3\envs\Jupyter\Lib\site-packages\sionna\rt\scene.py:1498, in load_scene(filename, dtype)
1496 if filename is None:
1497 filename = "__empty__"
-> 1498 return Scene(filename, dtype=dtype)
File D:\Users\glauc\anaconda3\envs\Jupyter\Lib\site-packages\sionna\rt\scene.py:134, in Scene.__init__(self, env_filename, dtype)
131 self._scene = mi.load_file(env_filename)
133 # Instantiate the solver
--> 134 self._solver_paths = SolverPaths(self, dtype=dtype)
136 # Solver for coverage map
137 self._solver_cm = SolverCoverageMap(self, solver=self._solver_paths,
138 dtype=dtype)
File D:\Users\glauc\anaconda3\envs\Jupyter\Lib\site-packages\sionna\rt\solver_base.py:162, in SolverBase.__init__(self, scene, solver, dtype)
159 face_indices = dr.ravel(face_indices3)
160 # Get vertices coordinates
161 # [n_prims*3, 3]
--> 162 vertex_coords = s.vertex_position(face_indices)
163 # Move to TensorFlow
164 # [n_prims*3, 3]
165 vertex_coords = mi_to_tf_tensor(vertex_coords, self._rdtype)
TypeError: vertex_position(): incompatible function arguments. The following argument types are supported:
1. (self: mitsuba.scalar_rgb.Mesh, index: int, active: bool = True) -> mitsuba.llvm_ad_rgb.ScalarPoint3f
Invoked with: PLYMesh[
name = "Pra_a_de_Servi_os_da_UFMG-itu_concrete.ply",
bbox = BoundingBox3f[
min = [-365.826, 0, 181.158],
max = [-251.228, 14.8316, 294.47]
],
vertex_count = 50,
vertices = [600 B of vertex data],
face_count = 50,
faces = [600 B of face data],
face_normals = 1
], [0, 1, 2]
Then it seems that this scene causes a bug in SionnaRT, not in the exporter itself. I recommend you open an issue on their GitHub one.
Thanks for the help @bathal1!
Reopened @glopesr's issue on the Sionna side now that it's a Sionna error: https://github.com/NVlabs/sionna/issues/357
Regarding Blender 4.0, we have just made a new release of the exporter that should support it.
For the record, I am running Blender 4.0 and installed the latest version of the exporter (0.4.0), and I am still getting the error:
Python: Traceback (most recent call last):
File "/Users/joey/Library/Application Support/Blender/4.0/scripts/addons/mitsuba-blender/io/__init__.py", line 136, in execute
self.converter.scene_to_dict(deps_graph, window_manager)
File "/Users/joey/Library/Application Support/Blender/4.0/scripts/addons/mitsuba-blender/io/exporter/__init__.py", line 97, in scene_to_dict
geometry.export_object(object_instance, self.export_ctx, evaluated_obj.name in particles)
File "/Users/joey/Library/Application Support/Blender/4.0/scripts/addons/mitsuba-blender/io/exporter/geometry.py", line 148, in export_object
name += f'-{n_mat_refs:03d}'
File "/Users/joey/Library/Application Support/Blender/4.0/scripts/addons/mitsuba-blender/io/exporter/geometry.py", line 29, in convert_mesh
AttributeError: 'Mesh' object has no attribute 'calc_normals'. Did you mean: 'flip_normals'?
However, specifying my Mitsuba binary directory as a custom path solves the issue, so perhaps there is a bug regarding which version of Mitsuba is being recognized by Blender?
This is surprising, since the error message mentions the call being on line 29, which is where the call was before that release.
When updating the addon, did you delete the previous version first ?
Right... I did click "Remove" on the add-on before re-adding it, was that enough to wipe the old version? Perhaps there is some caching going on?
I'm not sure, you might need to restart blender as well.
AH! That's it, all good now! You can close :) I learned something today.
I also can't export the scene as an .xml file. The error in the attached image appears.
What is the correct version of Blender that I should use?
Hi @alialsahlany,
I seems that the error you are encountering is unrelated to this (closed) issue. Please open a new issue with all the relevant information so we can help you. In particular, make sure to specify which version of Blender and the add-on you are using, on which platform, and if possible a minimal blender scene that reproduces the error you are facing.
I am not able to export a .xml. I have the following error. Can anyone help me?
![error](https://github.com/mitsuba-renderer/mitsuba-blender/assets/71104353/390c0798-3bac-4ff6-9518-d50635def960)