Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As it is now, Korman does not correctly export vertex normals as they appear in Blender.
Blender computes actual mesh normals (=what is used by the viewport for shading) according to (non exhaustive list):
use_smooth
)use_edge_sharp
)use_auto_smooth
&auto_smooth_angle
). Very useful for modelling machines with both smooth and sharp angles !On export, Korman currently tries to reuse common vertices between polygons (which is good), but is a bit too eager and reuses vertices which are part of polygons with different normals. It also doesn't use the right property to get the actual normal that respects all of the above (edge sharpness, auto smooth angle, etc). There are some times where it kinda works and others where it fails, but I won't get into the details.
What this MR does is retrieve the true normal (again, what is used by Blender's viewport, more or less) and use that when looking for an existing vertex / exporting a new vertex.
Pros:
Cons:
Backwards compatibility: previous files will see improvements if re-exported, if they relied on any of the previously mentioned effects (RT light, specular, cubemaps). No effect on baked lighting. May cause big meshes that previously exported fine to hit the vertex limit and fail.
Example of properly exported normals:

Left: Plasma result of a cubemapped object. Middle: mesh normals, seen using Blender's matcap. Right: edit mode displaying sharp edges.