Skip to content

Commit

Permalink
Invalid normals fix attempt 2
Browse files Browse the repository at this point in the history
  • Loading branch information
Steven Garcia committed Oct 13, 2024
1 parent 7e1adb2 commit 34cd519
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions io_scene_halo/file_ass/process_scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,9 @@ def process_scene(context, version, game_version, hidden_geo, nonrender_geo, app
if not loop_normals:
normal = (object_matrix.to_3x3() @ vertex_data.normal).normalized()

if normal.length <= 0.0:
normal = (object_matrix.to_3x3() @ face.normal).normalized()

scaled_translation = mesh_processing.process_mesh_export_vert(vertex_data, "ASS", object_matrix, custom_scale)
uv_set = mesh_processing.process_mesh_export_uv(evaluted_mesh, "ASS", loop_index, version)
color = mesh_processing.process_mesh_export_color(evaluted_mesh, loop_index, point_idx)
Expand Down
3 changes: 3 additions & 0 deletions io_scene_halo/file_jms/process_scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,9 @@ def process_scene(context, version, game_version, generate_checksum, fix_rotatio
if not loop_normals:
normal = (original_geo_matrix.to_3x3() @ vertex_data.normal).normalized()

if normal.length <= 0.0:
normal = (original_geo_matrix.to_3x3() @ face.normal).normalized()

scaled_translation = mesh_processing.process_mesh_export_vert(vertex_data, "JMS", original_geo_matrix, custom_scale)
uv_set = mesh_processing.process_mesh_export_uv(evaluted_mesh, "JMS", loop_index, version)
color = mesh_processing.process_mesh_export_color(evaluted_mesh, loop_index, point_idx)
Expand Down

0 comments on commit 34cd519

Please sign in to comment.