We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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 text was updated successfully, but these errors were encountered:
No branches or pull requests
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
The text was updated successfully, but these errors were encountered: