From 4d013bb6704b22be48bf1b59a4d073301d9dffa5 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Sat, 24 Apr 2021 19:36:29 -0400 Subject: [PATCH] Fix emissive lightmaps broken by a203e10. --- korman/exporter/material.py | 7 ++++++- korman/exporter/mesh.py | 5 ++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/korman/exporter/material.py b/korman/exporter/material.py index 95bb2a5..c7326e6 100644 --- a/korman/exporter/material.py +++ b/korman/exporter/material.py @@ -1263,7 +1263,12 @@ class MaterialConverter: state.shadeFlags |= hsGMatState.kShadeWhite if bm.emit: - state.shadeFlags |= hsGMatState.kShadeEmissive + # Lightmapped emissive layers seem to cause cascading render issues. Skip flagging it + # and just hope that the ambient color bump is good enough. + if bo.plasma_modifiers.lightmap.bake_lightmap: + self._report.warn("A lightmapped and emissive material??? You like living dangerously...", indent=3) + else: + state.shadeFlags |= hsGMatState.kShadeEmissive # Colors layer.ambient = self.get_material_ambient(bo, bm) diff --git a/korman/exporter/mesh.py b/korman/exporter/mesh.py index e8f1ac7..fb2127e 100644 --- a/korman/exporter/mesh.py +++ b/korman/exporter/mesh.py @@ -281,11 +281,10 @@ class MeshConverter(_MeshManager): if check_layer_shading_animation(base_layer): return False - # Reject emissive and shadeless because the kLiteMaterial equation has lots of options - # that are taken away by VtxNonPreshaded that are useful here. + # kShadeWhite (used for shadeless) is not handled for kLiteVtxNonPreshaded if material_idx is not None: bm = mesh.materials[material_idx] - if bm.emit or bm.use_shadeless: + if bm.use_shadeless: return False mods = bo.plasma_modifiers