I am trying to assign materials to the faces of my mesh, after exporting from Blender.
I can't find a way of assigning the materials directly in Mitsuba, or alternatively without having to find all the centers and then find the corresponding face in Blender again.
Description
As mentioned, from an algorithm that I created, I have a list of indexes of the faces and the corresponding materials:
Now what I would like to do here, is to assign all the materials to the faces. The materials are already present, as I created them in blender and exported them. The resulting files are 4 meshes (because I have 4 materials), and all of them consists of all the faces.
The problem that I am facing is that I couldn't find a way to assign materials directly in Mitsuba, or alternatively to find a map between the indexes of the faces in Mitsuba and in Blender. Therefore the only thing that I had in mind to do was to find in with Mitsuba all the centers, and then iterate over all the faces in blender and find the center that is closest to the value that mitsuba gives me.
This however gives me a big problem. If I have N faces, I would have to do $O(N^2)$ operations, which I would like to avoid since my mesh can be very big.
Do you have any clue on how I could approach this problem in Mitsuba directly?
Summary
I am trying to assign materials to the faces of my mesh, after exporting from Blender. I can't find a way of assigning the materials directly in Mitsuba, or alternatively without having to find all the centers and then find the corresponding face in Blender again.
Description
As mentioned, from an algorithm that I created, I have a list of indexes of the faces and the corresponding materials:
Now what I would like to do here, is to assign all the materials to the faces. The materials are already present, as I created them in blender and exported them. The resulting files are 4 meshes (because I have 4 materials), and all of them consists of all the faces.
The problem that I am facing is that I couldn't find a way to assign materials directly in Mitsuba, or alternatively to find a map between the indexes of the faces in Mitsuba and in Blender. Therefore the only thing that I had in mind to do was to find in with Mitsuba all the centers, and then iterate over all the faces in blender and find the center that is closest to the value that mitsuba gives me.
This however gives me a big problem. If I have N faces, I would have to do $O(N^2)$ operations, which I would like to avoid since my mesh can be very big.
Do you have any clue on how I could approach this problem in Mitsuba directly?