From 34cd51996bbabfe9e6c526843dd32cd526bde7df Mon Sep 17 00:00:00 2001 From: Steven Garcia Date: Sun, 13 Oct 2024 01:07:08 -0500 Subject: [PATCH] Invalid normals fix attempt 2 --- io_scene_halo/file_ass/process_scene.py | 3 +++ io_scene_halo/file_jms/process_scene.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/io_scene_halo/file_ass/process_scene.py b/io_scene_halo/file_ass/process_scene.py index 9b01486c8..a8d04cd17 100644 --- a/io_scene_halo/file_ass/process_scene.py +++ b/io_scene_halo/file_ass/process_scene.py @@ -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) diff --git a/io_scene_halo/file_jms/process_scene.py b/io_scene_halo/file_jms/process_scene.py index 094934041..0ce87a65f 100644 --- a/io_scene_halo/file_jms/process_scene.py +++ b/io_scene_halo/file_jms/process_scene.py @@ -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)