Blender PLY Exporter, exporting broken UV/ST coordinates. #103230

Closed
opened 2022-12-14 22:37:58 +01:00 by billgoysa · 10 comments

The UV coordinates exported by the PLY exporter in Blender do not work anywhere else on complex meshes, other than for importing back into blender, making them useless?

Use the obj from here: https://developer.blender.org/T103199

Convert it to ASCII PLY, then load it and the texture into here: https://www.creators3d.com/online-viewer

Or anything that is not Blender. Observe broken UV/ST coordinates.

Texture map added to this issue.d.png

The UV coordinates exported by the PLY exporter in Blender do not work anywhere else on complex meshes, other than for importing back into blender, making them useless? Use the obj from here: https://developer.blender.org/T103199 Convert it to ASCII PLY, then load it and the texture into here: https://www.creators3d.com/online-viewer Or anything that is not Blender. Observe broken UV/ST coordinates. Texture map added to this issue.![d.png](https://archive.blender.org/developer/F14058037/d.png)
Author

Added subscriber: @billgoysa

Added subscriber: @billgoysa

Added subscriber: @MikhailRachinskiy

Added subscriber: @MikhailRachinskiy

Please provide simple PLY ASCII example file with correct UVs.

Please provide simple PLY ASCII example file with correct UVs.
Author

I don't have the means to do that, because I can only generate PLY ASCII using Blender. I convert the PLY files to OpenGL buffers, you could look at how the OBJ exporter creates its UV coordinates because those are correct. For this reason I am tempted to created a OBJ to OpenGL buffers converter.

The PLY exporter served me really well when I was only exporting vertex colours, but surprisingly it's UV export has been broken since blender 2.7b is the earliest I have tested, so presumably it's always exported broken UV coordinates, which is shocking to think how few people use the exporter for that purpose to have not reported the issue.

I don't have the means to do that, because I can only generate PLY ASCII using Blender. I convert the PLY files to OpenGL buffers, you could look at how the OBJ exporter creates its UV coordinates because those are correct. For this reason I am tempted to created a OBJ to OpenGL buffers converter. The PLY exporter served me really well when I was only exporting vertex colours, but surprisingly it's UV export has been broken since blender 2.7b is the earliest I have tested, so presumably it's always exported broken UV coordinates, which is shocking to think how few people use the exporter for that purpose to have not reported the issue.

It's pointless to look at OBJ files as it is different file format, it has its own specification and organizes geometry data differently from PLY format.

There is no example of exporting UVs in official PLY spec .

I looked at MeshLab exported PLY file, and it does export UVs differently from Blender. Blender puts UVs data in vertex domain, whereas MeshLab puts them in face corners. Both are valid but have different uses.

I will take on this task, in no particular timeframe.

It's pointless to look at OBJ files as it is different file format, it has its own specification and organizes geometry data differently from PLY format. There is no example of exporting UVs in [official PLY spec ](http://gamma.cs.unc.edu/POWERPLANT/papers/ply.pdf). I looked at MeshLab exported PLY file, and it does export UVs differently from Blender. Blender puts UVs data in vertex domain, whereas MeshLab puts them in face corners. Both are valid but have different uses. I will take on this task, in no particular timeframe.
Mikhail Rachinskiy self-assigned this 2022-12-15 15:19:38 +01:00

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

Changed status from 'Needs Triage' to: 'Confirmed'
Author

This comment was removed by @billgoysa

*This comment was removed by @billgoysa*
Author

Small update for you, I did get the existing UV/ST to work from the PLY exporter, I just had to flip the V/T coordinate, if you add flip check boxes for each of the two texture coordinates this should solve the problem.

A UV map exported from an OBJ does look better but it also doubles the vertex count.

I hope this helps!

So in OpenGL buffers, flip V/T and it works fine! A lot of software renders in this OpenGL spec so that's why it was broken on many other softwares,

In that sense it might also be good to add a drop down above the invert U/V check boxes that allows you to select OpenGL, so its explicit that people know that the UV's being exported are ready to be dumped right into OpenGL.

OpenGL is bottom up texture coords, so that's why the V needed flipping, DirectX is top down, so for DirectX you would not need to flip V.

So in that sense you could add both DirectX and OpenGL to the dropdown.

https://www.saschawillems.de/images/2019-03-29-vulkan-flipping-the-viewport/viewports_gl_vk.png

Here you can see Vulkan is also the same as DirectX and I believe Metal is the same too, which means OpenGL is the only odd one out that I have found so far not following convention.

A face corner / vertex domain selection would still be really cool, but a little stat showing the exported vertex would probably be necessary if you added that, so people really know the impact of the decision they are making.

Oh yes and also, correct me if I am wrong but.. I am pretty sure that if I select my mesh, go into edit mode, select all the vertices, click the Edge dropdown, select "Mark Sharp", go back into Object mode, add the modifier "Edge Split", apply it. If I export the mesh with UV's now I get the OBJ UV mapping/face corner when I export the PLY. But this does result in a way higher vertex count than the OBJ would export so maybe not perfect lol. I suppose one could also select all the vertex in edit mode, select Mesh drop down, select Split > Faces by Edges, then right click the mesh and select Seperate > By Loose Parts and then in object mode select all faces and join them but that's slower.

Small update for you, I did get the existing UV/ST to work from the PLY exporter, I just had to flip the V/T coordinate, if you add flip check boxes for each of the two texture coordinates this should solve the problem. A UV map exported from an OBJ does look better but it also doubles the vertex count. I hope this helps! So in OpenGL buffers, flip V/T and it works fine! A lot of software renders in this OpenGL spec so that's why it was broken on many other softwares, In that sense it might also be good to add a drop down above the invert U/V check boxes that allows you to select OpenGL, so its explicit that people know that the UV's being exported are ready to be dumped right into OpenGL. OpenGL is bottom up texture coords, so that's why the V needed flipping, DirectX is top down, so for DirectX you would not need to flip V. So in that sense you could add both DirectX and OpenGL to the dropdown. https://www.saschawillems.de/images/2019-03-29-vulkan-flipping-the-viewport/viewports_gl_vk.png Here you can see Vulkan is also the same as DirectX and I believe Metal is the same too, which means OpenGL is the only odd one out that I have found so far not following convention. A face corner / vertex domain selection would still be really cool, but a little stat showing the exported vertex would probably be necessary if you added that, so people really know the impact of the decision they are making. Oh yes and also, correct me if I am wrong but.. I am pretty sure that if I select my mesh, go into edit mode, select all the vertices, click the Edge dropdown, select "Mark Sharp", go back into Object mode, add the modifier "Edge Split", apply it. If I export the mesh with UV's now I get the OBJ UV mapping/face corner when I export the PLY. But this does result in a way higher vertex count than the OBJ would export so maybe not perfect lol. I suppose one could also select all the vertex in edit mode, select Mesh drop down, select Split > Faces by Edges, then right click the mesh and select Seperate > By Loose Parts and then in object mode select all faces and join them but that's slower.

Thanks for the heads up, I made a test file with UV stored in face corners and it appears to work well (except that online service you provided seems to only support triangles with UVs).

Now, I need to rewrite exporter and importer. No timeframe.

Thanks for the heads up, I made a test file with UV stored in face corners and it appears to work well *(except that online service you provided seems to only support triangles with UVs)*. Now, I need to rewrite exporter and importer. No timeframe.

3.6 will have new experimental C++ PLY exporter 43e9c90061, current Python PLY exporter will be marked as legacy and will no longer be developed, therefore I am closing this task as obsolete.

Please test your case against new experimental PLY exporter, and if same issue occurs open a new bug report.

3.6 will have new experimental C++ PLY exporter https://projects.blender.org/blender/blender/commit/43e9c90061fc1ebae46a2780f932c64a0f615e78, current Python PLY exporter will be marked as legacy and will no longer be developed, therefore I am closing this task as obsolete. Please test your case against new experimental PLY exporter, and if same issue occurs open a new bug report.
Blender Bot added
Status
Archived
and removed
Status
Confirmed
labels 2023-03-20 19:24:24 +01:00
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#103230
No description provided.