#196 .3ds import oddities

open
None
5
2012-10-25
2004-11-10
elrond79
No

I noticed recently some errors in the way wings imports
.3ds files... namely, that it will not make any
polygons with > 4 vertices, and if your scene has a
dummy object in it, then any objects which are children
of some other will be placed in the scene incorrectly.

However, after poking around in the code, I found that
both of these seem to be the result of INTENTIONAL
choices: in the comments for the "make_quads" function
in e3d_mesh.erl, Bjorn states he deliberately chose not
to merge triangles with > 2 invisible sides, and the
e3d_tds.erl file contains a function - ironically named
"fix_transform_0" that is only invoked if the scene
contains a dummy objects, and which then procedes to
screw up the local transforms.

For the first problem, Bjorn states he wishes to avoid
convex polygons and isolated vertices - but convex
polygons are possible even with 4 vertices, and
eliminating or ignoring isolated vertices isn't hard.
I've added some code to my e3d_mesh.erl which will
allow > 4 sided polygons, and it seems to work just fine.

As for the 2nd problem, I'm scratching my head on that.
I basically commented out the call to fix_transform_0,
and it now imports scenes with hierarchies and dummy
objects just fine.

Of course, I don't know all the subtleties of the .3ds
format, so I may be missing something. Anyway, here's
my modified code... parts I changed are marked with "%%
Altered"...

Discussion

  • elrond79

    elrond79 - 2004-11-10
     
  • elrond79

    elrond79 - 2004-11-10
     
  • Bjorn Gustavsson

    Logged In: YES
    user_id=286649

    Thanks!

    Your version of e3d_mesh.erl will be included in the next release of
    Wings.

    Regarding the change in e3d_tds.erl, the fix_transform_0 function did
    seem to be correct for the .3DS files having dummy objects that I tried.

    Maybe you could upload some sample 3DS files that I could have a look
    at? (And .wings file with the same object as a reference.) Do you have
    any more information about the 3DS format and dummy objects? All I
    have is what I have been able to find on the Internet, and it is
    incomplete and sometimes inconsistent.

     

Log in to post a comment.