Jump to content


Photo

Help to fix proper edge winding with ASE exporter


  • Please log in to reply
3 replies to this topic

#1 LDAsh

LDAsh

    Member

  • Member
  • PipPip
  • 81 posts

Posted 14 October 2017 - 08:17 AM

I'd really like to fix the way the ASE exporter (and others) orientates the middle edges of the quads it exports.  They are opposite of how they should be, as seen in Radiant.  To illustrate, I have this pic below - on the left is the original patches that I exported, and on the right is the ASE model that I imported back into Radiant.  You'll see how the inner edges are orientated differently, and in this case gives a different shape, and in other cases may affect the way the textures are warped on these faces.
ASEtriswinding.png
(I added the extras lines in the orthographic view to demonstrate this, but they are 4 patches, not brushes)

I'm also trying to figure out how to do this in Blender, but I don't think it's possible.  Perhaps Meshlab can do it.  There is a line in the Python script here:-

            for x in reversed(winding):

                verts.append([x.vertex.x(), x.vertex.y(), x.vertex.z(), x.texcoord.x(), x.texcoord.y() * -1, x.normal.x(), x.normal.y(), x.normal.z()])

A tweak to this may be what's needed, but I have no idea how.  I might try to play with it in a while.

Exporting as OBJ corrects the orientation of the inner edges of the quads, but using this method loses the material headers, this information is not exported.

 


  • Anderson likes this

#2 LDAsh

LDAsh

    Member

  • Member
  • PipPip
  • 81 posts

Posted 14 October 2017 - 01:11 PM

So yeah, MeshLab can certainly do this:-
ASEtriswinding2.png
...but with a couple of important caveats.  Here's how anyway:-
_______________________________________
Convert ASE to OBJ, change any "/s" into "!s" (to (try to) preserve full material headers), and import mesh into MeshLab:-

Filters >
    Polygonal and Quad Mesh >
        Turn into Quad-Dominant mesh -
        (Optimize For: Better quad shape)
Filters >
    Selection >
        Select non Manifold Edges
Filters >
    Remeshing, Simplification and Reconstruction >
        Planar flipping optimization -
        (Planar metric = area/max side)
        (Post optimization relax iterations = 0.0)

...then export to OBJ, which is a different version that Blender doesn't seem to like, but there are converters to fix that.
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
So the issues are - I can't seem to reliably retain the material headers, and it will also reposition the mesh to the middle of the object on exporting, which may or may not be a big deal depending on the proportions of what is exported.  This can probably be circumvented by encasing everything in a giant cube, possibly.  MeshLab's OBJ exporter doesn't have a lot of options there, so although it does work, the material header issue is the deal-breaker for keeping it an efficient overall solution.  It prefers the filename over the material header, unfortunately.  If it were as simple as this 4-quad 1-material test, sure, no biggy, but in practice we'd be shoving around (tens or even hundreds of) thousands of triangles, with dozens of different materials, and it's just not reasonable to spend hours in a text editor, fixing every damn material header, every damn time.

 


  • AluminumHaste and Anderson like this

#3 AluminumHaste

AluminumHaste

    Darkmod Contributor

  • Development Role
  • PipPipPipPipPip
  • 6189 posts

Posted 16 October 2017 - 09:56 AM

Nice work.


I always assumed I'd taste like boot leather.

 

#4 LDAsh

LDAsh

    Member

  • Member
  • PipPip
  • 81 posts

Posted 19 October 2017 - 02:51 PM

Nice work? :P  No, looks like I'm going to need to make a chunky-ass macro to fix all the material headers automatically...






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users