Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with Fragmented Texture in OBJ Export using writeToOBJZip - Flipping Y axis didn't work #22

Open
sikandar-visionbotix opened this issue Aug 15, 2024 · 1 comment

Comments

@sikandar-visionbotix
Copy link

I'm currently working on exporting a 3D mesh in OBJ format using the following command:

scene.mesh?.writeToOBJZip(atPath: documentsURL.appendingPathComponent("objzip").path)

However, I'm encountering an issue where the texture on the exported OBJ file appears fragmented or incorrectly mapped. The geometry of the OBJ file itself seems to be correct, but the texture does not align properly—it appears random and disjointed across the model.

Interestingly, when I export the same scene in PLY format, the texture and model are in good shape, with no issues in texture mapping or alignment.

I have seen suggestions in previous posts about modifying UV mapping, specifically looking for code lines that involve something like '1.0 - uv.y' to address potential issues with texture flipping. However, I couldn't find any such line in my codebase. Also I tried blender to flip uv but it didn't work.

objzip

Has anyone encountered a similar issue or have insights into what might be causing this fragmented texture in the OBJ export? Any suggestions on how to correct the UV mapping or ensure the texture is applied correctly during the export process would be greatly appreciated.

Thank you in advance for your help!

@aaptho
Copy link
Collaborator

aaptho commented Sep 9, 2024

I could be wrong, but it seems some programs read UV map coordinates with 0,0 as top left, and some as bottom left.
If you flip the texture vertically, this result will likely be correct.

This framework’s PLY export function previously used the opposite origin as OBJ export, but we flipped OBJ to match PLY in commit 0689b06

Does the program reading your OBJ file have an option to set the origin, or to read the texture upside down?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants