Open ydove0324 opened 7 months ago
the code looks like this
albedo_image = Image.open(f"{path}/albedo.jpg") emission_image = Image.open(f"{path}/emission.jpg") normal_image = Image.open(f"{path}/normal.jpg") # 创建 mesh 对象 mesh = trimesh.Trimesh() # 提取顶点坐标并转换为 NumPy 数组 vertices = np.array([list(vertex_coords.values()) for vertex_coords in data["vertices"]], dtype=np.float64) mesh.vertices = vertices # 提取法线并转换为 NumPy 数组 normals = np.array([list(normal.values()) for normal in data["normals"]], dtype=np.float64) mesh.vertex_normals = normals # 提取三角形索引 triangles = np.array(data["triangles"], dtype=np.int32).reshape(-1, 3) mesh.faces = triangles # 填充纹理坐标信息 uvs = np.array([list(uv.values()) for uv in data["uvs"]], dtype=np.float64) # 创建纹理和材质 albedo_material = trimesh.visual.texture.SimpleMaterial(image=albedo_image) emission_material = trimesh.visual.texture.SimpleMaterial(image=emission_image) normal_material = trimesh.visual.texture.SimpleMaterial(image=normal_image) # 应用纹理 material = trimesh.visual.material.TextureMaterial( diffuse=albedo_image, emissive=emission_image, normal_map=normal_image )
although it's a wrong code. But I want to load emission and normal into the mesh
how to use trimesh to deal with them
the code looks like this
although it's a wrong code. But I want to load emission and normal into the mesh
how to use trimesh to deal with them