0

In Blender, using the Blosm addon, I can load a map. Using the code provided here, I can export all the meshes as separate .obj files. To display a particular .obj file named test_obj.obj, located at C:/here, I have the following code

import numpy as np
import pywavefront
import plotly.graph_objects as go

Load the .obj file

obj_path = r"C:/here/test_obj.obj" scene = pywavefront.Wavefront(obj_path, collect_faces=True)

Extract vertices

vertices = np.array(scene.vertices)

Extract faces

faces = [] for name, mesh in scene.meshes.items(): for face in mesh.faces: faces.append(face) faces = np.array(faces)

Create the figure

fig = go.Figure(data=[ go.Mesh3d( x=vertices[:, 0], y=vertices[:, 1], z=vertices[:, 2], i=faces[:, 0], j=faces[:, 1], k=faces[:, 2], ) ])

fig.update_layout(scene_aspectmode='data') # 'data', 'cube', 'auto', 'manual' fig.show()

There are some orientation and "filling" issues with the resulting plot. To illustrate my point, please consider the following image, where on the left is the map in Blender, and on the right the result of the display (considering only the buildings of the left part). Comparison betwwen Blender map and reconstruciton

The issues are the following

  1. The orientations are different
  2. Some "voids" seemed to be filled in the reconstruction shown on the right (consider, for instance, the building shaped like a cross on the left. The display on the right adds additional faces)

How can I solve those issues?

aheuchamps
  • 27
  • 5

0 Answers0