Anim8or Community

Please login or register.

Login with username, password and session length
Advanced search  

News:

Ian Ross has just released a book on Anim8or. It's perect for a beginner and a good reference for experienced users. It contains detailed chapters on every aspect, with many examples. Get your own copy here: "Anim8or Tutorial Book"

Author Topic: New converter to export to Collada (including animations!)  (Read 13579 times)

Enumer8

  • Newbie
  • *
  • Posts: 5
    • View Profile
New converter to export to Collada (including animations!)
« on: February 06, 2019, 09:43:25 pm »

Hi all,

I've been working the past several months on a converter from .an8 to .dae. I call it Anim8or Transl8or. The main reason is that my 3D artist prefers to use Anim8or, but .an8 files are not easy to import into other programs (like 3DS Max and Blender). I have self-tested the converter and am pretty satisfied with my progress. I think it is fairly robust. It turned out to be a lot more work than I originally planned, however!

Let me know what you think. You can download the latest version here: https://github.com/Enumer8/Anim8orTransl8or/releases. I get into a lot of detail about the limitations and how to use the program here: https://github.com/Enumer8/Anim8orTransl8or. Support for the Collada format in even major software is a lot worse than I original expected. I think I've found workarounds for most of the issues, but there is still plenty to be done. It would be cool if Collada support could be built into Anim8or eventually. I think my source code should be readable enough to use as an example of how it can be done.

Enjoy!
Logged

texel

  • Jr. Member
  • **
  • Posts: 81
    • View Profile
Re: New converter to export to Collada (including animations!)
« Reply #1 on: February 07, 2019, 03:08:30 am »

It takes a lot of time and motivation to study Anim8or and Collada file formats and to develop a converter. Great job!
I will test your program with Unity :)
Logged

Enumer8

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: New converter to export to Collada (including animations!)
« Reply #2 on: February 09, 2019, 05:49:50 pm »

Unity seems to have good support for loading animations from multiple dae files. It was pretty simple to create an animation controller and use them. Neat. Unity also renders transparency like 3DS Max and like how I expect from the COLLADA specification. I think Blender is simply wrong in how it renders it.

Another thing I would like to fix is that sometimes a bone will interpolate in exactly the wrong direction. This time, Blender interpolates it in the direction I expect and Autodesk and Unity interpolate opposite. I understand the basic problem, and this is how I handle it in my own engine that I am developing:

Code: [Select]
   constexpr const Quaternion LinearInterpolation(
      const Quaternion& a,
      const Quaternion& b,
      const Real32 t)
   {
      // Take the shortest path
      if ( Dot(a, b) >= 0 )
      {
         return Normalize(a + (b - a) * t);
      }
      else
      {
         return Normalize(a + (-b - a) * t);
      }
   }

I'm wondering if there is something I can do in the actual output dae file to make 3ds Max and Unity to work.
Logged

captaindrewi

  • Sr. Member
  • ****
  • Posts: 490
  • errm...errr?
    • View Profile
Re: New converter to export to Collada (including animations!)
« Reply #3 on: February 11, 2019, 11:50:39 am »

Had a go with a simple animated anim8or rig  and viola it appeared in blender. 8)
Logged
!

Enumer8

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: New converter to export to Collada (including animations!)
« Reply #4 on: February 16, 2019, 09:32:58 pm »

I published a new version of the converter. This new version supports multiple materials. Sadly, after much investigation, I was not able to prevent Unity from sometimes interpolating in the opposite direction. I thought maybe inserting some extra key frames in the middle to prevent a large change in angle would fix it, but it still goes the wrong way.
Logged

MrProtek

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: New converter to export to Collada (including animations!)
« Reply #5 on: November 12, 2023, 03:15:29 pm »

In the past i made simple 3D engine base on DX9 and i used an8 file format as my main format for it, im not sure if it will help but i had similar problem and to solve that i had to calculate Quaternion in different order...

Code: [Select]
For I := 0 To High(SequenceArray[LastSequence].FrameArray) Do
 Begin
    //MAKE QUATERNION FROM AXIS (Y-Z-X ORDER)
    QRotationY(Qy,SequenceArray[LastSequence].FrameArray[I].Bones[J].y*(Pi/180));
    QRotationZ(Qz,SequenceArray[LastSequence].FrameArray[I].Bones[J].z*(Pi/180));
    QRotationX(Qx,SequenceArray[LastSequence].FrameArray[I].Bones[J].x*(Pi/180));
    D3DXQuaternionMultiply(Qy,Qy,Qz);
    D3DXQuaternionMultiply(Qy,Qy,Qx);
    D3DXQuaternionNormalize(SequenceArray[LastSequence].FrameArray[I].Bones[J],Qy);
 End;

Base on my old source code right order is Y * Z * X
Logged