.OBJ export broken?

Anything related to a beta release of JPatch: Bugs, enhancements, general discussion...

.OBJ export broken?

Postby dcuny » Thu Feb 10, 2005 9:10 pm

I haven't been having a lot of luck getting the .obj export to give me clean meshes. I initially thought it might be an issue with normal facing the wrong way, but they certainly look OK in JPatch.

I imported this A:M model into JPatch, and exported it in .obj format. That much worked fine.

But when I imported it into Blender, the mesh had holes all over. I used a testing build because they have builtin support for .obj models.

I also tried importing it into the latest version of Anim8or, but got the same results. :?
Posts: 2902
Joined: Fri May 21, 2004 6:07 am

Postby sascha » Fri Feb 11, 2005 8:50 am

The version of JPatch you have still uses the old Bezier-Patch code for .OBJ output. This means that each patch is exported as individual triangle grid - Although they seem to connect seamlessly, they are actually not connected (they don't share common vertices on the patch boundaries).
The new Hash-Patch subdivision code produces much nicer (but still not optimal) meshes.

The second thing are the normals: Per default, "flip backfacing normals" is activated (Options -> Renderer settings). Some renderers do not support that (e.g. DirectX), so it is necessary to align all the patch normals. To see which faces are backfacing, either turn off backface-normal-flipping (this will cause backfacing triangles to receive no light) or activate backface culling (this disables rendering of backfacing triangles).

Note that in your version the "flip backfacing normals" and "cull backfacing polys" options are not stored in the preferences, so they return to their defaults when restarting JPatch :?

You can then use the "flip patches" and "align patches" tools (from the popup menu -> tools).
If the mesh does not contain something like a Moebius strip you can simply select the entire model and run "align patches"... This will cause all patches to face in the same direction (which might be the wrong one - in this case simply run "flip patches" afterwards).
If the topology of the model does confuse the align patches algorithm, you'll have to help out manually. But you can still use the align patches tool: Simply select only parts of the model that do not contain topologically problematic regions and run "align patches" (followed by "flip patches" if necessary). After that, individually select the remaining patches that face in the wrong direction and flip them.

JPatch remembers the orientation of a patch, so re-running "compute patches" will keep their orientation, but if you change patches (e.g. by inserting new points in the grid and connecting them) the new patches may be facing in the wrong direction - again use the align patches or flip patches options to correct them.

This should fix the .obj output as far as "holes" are concerned. The new code will also optimize the meshes to connect seamlessly. Without hooks, the new code generates completely closed meshes, so they are ready for Loop subdivision - I'm working on the hooks to aling the in-between points with existing vertices on the neighbor patch, but that might take some more time.

JPatch stores the orientation information of the patches by simply reversing their order: A patch might be defined by control-points 0,1,2,3 or 3,2,1,0 - the same patch, but facing in opposite directions. This is obviously not how A:M deals with it - I've got to look at the A:M file format to properly import patch orientation from A:M models...

Some new features will require oriented patches. E.g. the new "avarage normals" options, Loop SDS support and in future hair (you don't want the hair to grow inside the head :wink:), so it's always a good idea to aling the patches.

Right now, the "align patches" algorithm is easily confused, I'll try to make it a bit smarter in the future...
Site Admin
Posts: 2792
Joined: Thu May 20, 2004 9:16 am
Location: Austria

Postby dcuny » Fri Feb 11, 2005 10:28 am


I'll wait for a version of JPatch that "officially" supports the feature, then. I had just recalled that you said that the new mesh code should have fixed the export problems, and decided to try it out.
Posts: 2902
Joined: Fri May 21, 2004 6:07 am

Return to Beta

Who is online

Users browsing this forum: No registered users and 1 guest