Road-hog123 / Blender-OMSI-Exporter

OMSI Mesh (.o3d) exporter addon for Blender and Blender LTS
Apache License 2.0
24 stars 0 forks source link

Ability to export with custom split normals #10

Open Growl3D opened 1 year ago

Growl3D commented 1 year ago

The problem

Currently the exporter doesn't support custom split normals. These are used when the bevel modifier has the "Harden Normals" setting checked, or when using the Weighted Normal modifier. The autosmooth setting, found in the object data properties, under the subheading, normals, is required for these settings to work correctly. This causes faces to maintain uniform and flat shading on the model, while maintaining smooth curvature, unlike the usual method of using the edge split modifier.

The current workflow

Currently I am turning off the specularity in the material settings, using the edge split method instead to avoid any odd shading, and making use of 'container loops'.

The solution

For support to be added for this feature if at all possible, I can provide a test file if necessary.

Road-hog123 commented 1 year ago

Blender's own Mesh.transform() and Mesh.flip_normals() functions destroy the custom normals, and I very much wish they didn't.

Road-hog123 commented 1 year ago

@Growl3D Can you try this version and see if the export result is as you expect it to be? blender-omsi-exporter_split-normals.zip

Growl3D commented 1 year ago

Hi RoadHog, just writing to say I have got your message, I'm just doing a lot of overtime so no time for development atm. I'll test this the coming Monday.

Growl3D commented 1 year ago

Hi RoadHog, I've sent you a friend request on discord so I can send you some examples of the results now I've had a chance to test this new branch.

Road-hog123 commented 5 months ago

There does appear to be at least some cases (e.g. #17) in which exported normals are not correct, so I'm reopening this until I have unit tests to prove the exporter is working as intended.

Road-hog123 commented 4 months ago

https://github.com/Road-hog123/Blender-OMSI-Exporter/blob/912a67d0c5899a7204afd2bd1876d1523a8b2784/io_export_o3d/exporter.py#L251-L252 Yes, let's translate direction vectors, I'm sure that'll work just fine... 🙄

Experimental fixed versions: blender-omsi-exporter_3.2.1-rc.0.zip for Blender 3.6 LTS & 3.3 LTS blender-omsi-exporter_4.0.1-rc.0.zip for Blender 4.1 & 4.0

irisnotaprogrammer commented 4 months ago

This seems to have solved it. I used the version 3.2.1-rc.0.zip on 3.6.4. The separate models are now appearing as they should.

(Small edit: These models are, at least)