PLY Export or bug in Blender, joining two meshes causes exported normal's on second mesh to invert. #104159

Closed
opened 2023-01-26 23:17:27 +01:00 by billgoysa · 4 comments

System Information
Tested a wide variety of machines

Blender Version
occurs on all 2.8 to latest

Exact steps for others to reproduce the error
Create two separate meshes, join them to make one mesh and export it as PLY, sometimes the second mesh will export and when you load it into OpenGL the normals for the second mesh become inverted even though in blender they show as they should, normal, not inverted.

This has happened to me a lot and it's so annoying, I'm not sure if its something to do with the vertex winding order getting reversed somehow on the second joined mesh as I am aware vertex winding order may be used when it comes to determining face direction but I'm not sure on the exact details of that; https://www.gamedev.net/forums/topic/712275-vertex-winding-order-clockwise-or-counter-clockwise/

This doesn't happen for every join operation on two meshes, just some of them.

Here is a blend file where this occurred and you have to flip the vertices on the blue surfboard to point inwards (incorrect direction) to get it to export in the PLY file with normals pointing outwards file.blend

Notice how when you see the model in the .blend file the normals are all the correct direction, now export it to PLY and then import that PLY back into blender and the normals on the blue surfboard have been flipped.

I export the PLY as ASCII, Selection Only, everything apart from UV coordinates, no modifiers un-applied.
Screenshot_2023-01-26_22-27-11.png

**System Information** Tested a wide variety of machines **Blender Version** occurs on all 2.8 to latest **Exact steps for others to reproduce the error** Create two separate meshes, join them to make one mesh and export it as PLY, sometimes the second mesh will export and when you load it into OpenGL the normals for the second mesh become inverted even though in blender they show as they should, normal, not inverted. This has happened to me a lot and it's so annoying, I'm not sure if its something to do with the vertex winding order getting reversed somehow on the second joined mesh as I am aware vertex winding order may be used when it comes to determining face direction but I'm not sure on the exact details of that; https://www.gamedev.net/forums/topic/712275-vertex-winding-order-clockwise-or-counter-clockwise/ This doesn't happen for every join operation on two meshes, just some of them. Here is a blend file where this occurred and you have to flip the vertices on the blue surfboard to point inwards (incorrect direction) to get it to export in the PLY file with normals pointing outwards [file.blend](https://archive.blender.org/developer/F14201430/file.blend) Notice how when you see the model in the .blend file the normals are all the correct direction, now export it to PLY and then import that PLY back into blender and the normals on the blue surfboard have been flipped. I export the PLY as ASCII, Selection Only, everything apart from UV coordinates, no modifiers un-applied. ![Screenshot_2023-01-26_22-27-11.png](https://archive.blender.org/developer/F14201435/Screenshot_2023-01-26_22-27-11.png)
Author

Added subscriber: @billgoysa

Added subscriber: @billgoysa
Mikhail Rachinskiy was assigned by billgoysa 2023-01-26 23:28:44 +01:00

Changed status from 'Needs Triage' to: 'Resolved'

Changed status from 'Needs Triage' to: 'Resolved'

The issue is not with the PLY exporter, you probably have negative scale on one of the objects. So when this object gets merged this negative transform applies to mesh inverting its normals.

You can reproduce it by creating two cubes, then setting Scale X to -1.0, and merge it with another cube.

It is not a bug, that's just how transformations work. It is best to avoid negative scale when possible.

The issue is not with the PLY exporter, you probably have negative scale on one of the objects. So when this object gets merged this negative transform applies to mesh inverting its normals. You can reproduce it by creating two cubes, then setting Scale X to -1.0, and merge it with another cube. It is not a bug, that's just how transformations work. It is best to avoid negative scale when possible.
Author

Ah you are right! sorry, thank you so much I must have accidentally been scaling objects into negative scales without realising, it's not super obvious this is happening when using the scale tool unless I have the item transform tab open and even then I would not have specifically noticed the scale had gone into negative unless someone had pointed it out to me like you have now.

Thank you!

Ah you are right! sorry, thank you so much I must have accidentally been scaling objects into negative scales without realising, it's not super obvious this is happening when using the scale tool unless I have the item transform tab open and even then I would not have specifically noticed the scale had gone into negative unless someone had pointed it out to me like you have now. Thank you!
Sign in to join this conversation.
No Milestone
No project
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#104159
No description provided.