Maniphest T25225

OBJ exporter with quad faces + triangulation option ends up with wrong texcoords.
Closed, Archived

Assigned To
Campbell Barton (campbellbarton)
Authored By
Justin Paver (jpaver)
Dec 14 2010, 7:41 PM
Tags
  • BF Blender
Subscribers
Campbell Barton (campbellbarton)
Hella merdurial (arcueid511)
Justin Paver (jpaver)

Description

Use Blender 2.54, with OBJ Exporter patch from here: http://www.blendernation.com/2010/09/12/blender-2-54-beta-released/.

Create a mesh with quads, not triangles, and make sure they have a uv mapping. (see attached tree01.blend)

Export the mesh using OBJ exporter and select the triangulate option. These are the options I'm using:
True, # EXPORT_TRI
False, # EXPORT_EDGES
True, # EXPORT_NORMALS
False, # EXPORT_NORMALS_HQ, # not yet
True, # EXPORT_UV, # ok
True, # EXPORT_MTL,
False, # EXPORT_COPY_IMAGES,
True, # EXPORT_APPLY_MODIFIERS, # ok
True, # EXPORT_ROTX90, # wrong
True, # EXPORT_BLEN_OBS,
True, # EXPORT_GROUP_BY_OB,
False, # EXPORT_GROUP_BY_MAT,
False, # EXPORT_KEEP_VERT_ORDER,
False, # EXPORT_POLYGROUPS,
False, # EXPORT_CURVE_AS_NURBS,
False, # EXPORT_SEL_ONLY, # ok
False, # EXPORT_ALL_SCENES, # XXX not working atm
False); # EXPORT_ANIMATION): # Not used

The resultant OBJ has triangle faces, but each triangle that was sourced from the same quad ends up with the same texcoords. eg.

f 123/7/113 119/8/109 118/4/112
f 123/7/113 118/8/112 121/4/114
f 118/4/112 122/5/111 125/6/115
f 118/4/112 125/5/115 120/6/116
f 120/1/116 126/2/117 121/3/114
f 120/1/116 121/2/114 118/3/112

Notice the texcoord index (the middle coord) for each pair of faces is the same.

Event Timeline

Justin Paver (jpaver) edited a custom field.Dec 14 2010, 7:41 PM
Justin Paver (jpaver) attached 1 file(s): F14483: tree01.blend.
Justin Paver (jpaver) added a comment.Dec 14 2010, 7:56 PM

Note: if I select all faces and hit Ctrl-T (triangulate) before exporting, the texcoords are correct. This suggests the problem is likely with the EXPORT_TRI option in the export_obj script.

Campbell Barton (campbellbarton) added a comment.Dec 15 2010, 1:35 AM

this was fixed since 2.55 release, r33235.
closing.

Justin Paver (jpaver) added a comment.Dec 15 2010, 4:14 AM

Please re-open.

I'm afraid this specific issue, while similar to some that were fixed with release 2.55, is not actually fixed in release 2.55.
The polygons *are* being triangulated just fine, it's just their texture coordinates that are wrong.

To verify, I grabbed export_obj.py from release 2.55 and i still see the same issue. Moreover, a diff between release 2.54 script and 2.55 script shows the only script changes are:

scene_frames = range(scene.frame_start, context.frame_end + 1) # Up to and including the end frame.
-> scene_frames = range(scene.frame_start, scene.frame_end + 1) # Up to and including the end frame.

... and:

use_edges=False,
-> use_edges=True,

(neither of these changes seem related to this specific bug)

Campbell Barton (campbellbarton) added a comment.Dec 16 2010, 6:05 AM

re-opening, afraid I acted too quick!

Campbell Barton (campbellbarton) attached 1 file(s): F14488: tree01_compare.blend.Dec 16 2010, 2:34 PM
Campbell Barton (campbellbarton) added a comment.Dec 16 2010, 2:36 PM

Attached a file showing export & import with blender r33710.
there is no errors I can see, if you can find an error in this file please point it out and Ill look into the bug.

also you are comparing against 2.55, the bug may have been fixed since then.

closing.

Campbell Barton (campbellbarton) changed the task status from Unknown Status to Archived.Dec 16 2010, 2:36 PM