Skip to content

Commit

Permalink
Importer: Fix y-axis UV flip with the PLY object importer (#51)
Browse files Browse the repository at this point in the history
Mitsuba flips the UVs on the y-axis when exporting as PLY. We now flip 
them back when importing.

Fixes #50.
  • Loading branch information
ros-dorian authored Nov 22, 2022
1 parent 424f4d2 commit 5985305
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion mitsuba-blender/io/importer/bl_import_ply.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,9 @@ def load_ply_mesh(filepath, ply_name):
def add_face(vertices, indices, uvindices, colindices):
mesh_faces.append(indices)
if uvindices:
mesh_uvs.extend([(vertices[index][uvindices[0]], vertices[index][uvindices[1]]) for index in indices])
# Mitsuba seems to flip the UVS on the y-axis when exporting. We account for this here by flipping them
# back to the original coordinates.
mesh_uvs.extend([(vertices[index][uvindices[0]], 1-vertices[index][uvindices[1]]) for index in indices])
if colindices:
if len(colindices) == 3:
mesh_colors.extend([
Expand Down

0 comments on commit 5985305

Please sign in to comment.