Author Topic: Model converter (.ZTP) -0.1 - WIP  (Read 1403 times)

XL2

  • Sr. Member
  • ****
  • Posts: 341
  • Karma: +72/-1
    • View Profile
Re: Model converter (.ZTP) -0.05 - WIP
« Reply #15 on: June 08, 2018, 01:24:47 am »
The floor clipping is because of the z sort not set to max.
Just patch it yourself with a loop function after loading your map.
For the 3 letters names, I don't know what you mean.

SkimmingSanshiro

  • Newbie
  • *
  • Posts: 21
  • Karma: +3/-0
    • View Profile
Re: Model converter (.ZTP) -0.05 - WIP
« Reply #16 on: June 08, 2018, 01:33:49 am »
If your texture is a 3 letter word it wont show up. Was wondering what my deal was

XL2

  • Sr. Member
  • ****
  • Posts: 341
  • Karma: +72/-1
    • View Profile
Re: Model converter (.ZTP) -0.05 - WIP
« Reply #17 on: June 11, 2018, 04:11:25 am »
I haven't tested at the 3 letters textures, but I will look it up at a later time.

Very good news, I got the compressed animation working, including compressed normals!

A Sonic model with 40 frames of animation takes a total of 63 KB (including the textures).
I also got compressed normals working (1 quad now takes only 1 byte for normals instead of 12 bytes!).
The compression can lead to some minor issues where the quad gets clipped when it's in some extreme angles.
The vertices take 6 bytes instead of 12 bytes each.
I could compress the vertices further (4 bytes), but it might become a bit slower to decompress.
So, all in all, 40 frames of animation using vertices should amount to about 180 KB of data while now it's down to about 63 KB (minus the base model of 11-15 KB).
Note that you can interpolate these animations, so you could easily make it 1/4 or less this size!
At a level 2 interpolation (1 out of 4 frames) you would reduce the same model to 27 KB (with only 8 KB worth of animation data), making vertex animation cheap in terms of memory.

I will try to clean up my code and release the demo + updated tool tomorrow, but I'm not promising anything as I should have a very busy day so I might not feel like it in the evening!


 


XL2

  • Sr. Member
  • ****
  • Posts: 341
  • Karma: +72/-1
    • View Profile
Re: Model converter (.ZTP) -0.05 - WIP
« Reply #18 on: June 11, 2018, 04:39:31 am »
Ok, scratch that last one, I just did minimal clean up of the code.

Just remember : you need to have 1 base model, the other models will use that name +  "_000001" to whatever amount of frames you want.
The base model needs to write the material data, but not the animation.
Just make sure you keep the vertices order (I think it does it by default in Blender).

I'm also sharing the source code for the converter, it should be cleaner than last time...but I did make a mess while adding animation support!

Enjoy!

ponut64

  • Full Member
  • ***
  • Posts: 175
  • Karma: +13/-0
    • View Profile
Re: Model converter (.ZTP) -0.1 - WIP
« Reply #19 on: June 11, 2018, 05:35:20 am »
I'm almost done with some background-ish loading stuff too, I just need it to not-crash.

corvusd

  • Jr. Member
  • **
  • Posts: 81
  • Karma: +8/-0
    • View Profile
    • Personal Web Portfolio
Re: Model converter (.ZTP) -0.05 - WIP
« Reply #20 on: June 11, 2018, 10:35:06 pm »
Ok, scratch that last one, I just did minimal clean up of the code.

Just remember : you need to have 1 base model, the other models will use that name +  "_000001" to whatever amount of frames you want.
The base model needs to write the material data, but not the animation.
Just make sure you keep the vertices order (I think it does it by default in Blender).

I'm also sharing the source code for the converter, it should be cleaner than last time...but I did make a mess while adding animation support!

Enjoy!

Absolutely amazing! :D
David Gámiz Jiménez

XL2

  • Sr. Member
  • ****
  • Posts: 341
  • Karma: +72/-1
    • View Profile
Re: Model converter (.ZTP) -0.1 - WIP
« Reply #21 on: June 15, 2018, 04:26:14 am »
Here is how it looks like in action :

https://youtu.be/9q5zSLxVBAI

ponut64

  • Full Member
  • ***
  • Posts: 175
  • Karma: +13/-0
    • View Profile
Re: Model converter (.ZTP) -0.1 - WIP
« Reply #22 on: June 19, 2018, 02:39:28 pm »
Hello, I would like to report a bug, and make a suggestion.

The bug is I cannot seem to get the animation conversion process handle more than 1 keyframe.
e.g. if I put in for 2 3 or 4 or 5 or 1,000 keyframes, it will only process and interpolate the first key frame (filename_000001).
It seems to check for the presence of the other keyframes, but doesn't process them.

My other suggestion is variable interpolation rates. This is probably a lot of work, and I am quite grateful for all you have done already. That said the best animations don't necessarily have each keyframe exactly the same number of frames apart. For example, injecting keyframes at critical parts of a walk cycle are essential to getting them to look right. Or, if for a punch animation, you don't want the windup of the punch to have the same number of frames interpolated for it as the throw.

My request for the process is as follows:
1)First, the model converter requests the file name to be used as the base of animation state.
2)Then it asks if this model is animated. If yes, you are requested to input the next keyframe filename. If no, input 0.
3)It then asks how many frames to interpolate up to this keyframe.
4)It then asks for another keyframe file-name. If this is the last keyframe, you can put in "0" and it will execute.
5)It then asks for this keyframe's source frame (the keyframe to interpolate from). You type in a file name. If that file is not a registered keyframe, the program gives an error and exits.
6)Repeat from 3.

7)If execution has started, it asks for the model's scale.

All this really does is simplify the conversion process and save a tiny bit more memory, since I can still just convert every two frames with massive memory savings on the interpolated frames. The downside is that each keyframe is duplicated in the next animated mesh. With these improvements, that would be prevented.

.. And just an addendum, I did update my loading function to work with the new binary files.
« Last Edit: June 19, 2018, 02:53:45 pm by ponut64 »

XL2

  • Sr. Member
  • ****
  • Posts: 341
  • Karma: +72/-1
    • View Profile
Re: Model converter (.ZTP) -0.1 - WIP
« Reply #23 on: June 19, 2018, 02:55:57 pm »
The interpolation factor is mainly for testing.
You can set it to 0 and manually set your interpolation for each animation.
This is what I do in Sonic Z-Treme.
Just do your animation on blender, once you are satisfied just keep the relevant keyframes and use an interpolation factor of 0.
The problem with entering each filename is that it makes the process way too long.

For the bug, you need to have a base model (say Ponut.obj) AND your keyframes (ponut_00001.obj, etc).
The base model must include the materials, but not the others.

I will revisit this tool at a later time to improve it, but you can also play with the source code to add custom features.

ponut64

  • Full Member
  • ***
  • Posts: 175
  • Karma: +13/-0
    • View Profile
Re: Model converter (.ZTP) -0.1 - WIP
« Reply #24 on: June 19, 2018, 03:04:40 pm »
Thanks for the tip about manual interpolation rates. Looking over the animated display code in your demo, I realize that's where the interpolation is handled so that's far simpler than how I thought it was happening. I can handle that

The "bug" is fixed by setting interpolation factor to 0, then it doesn't skip anything.
The number seems to look ahead by the interpolation factor + 1 when looking for the next file.
Sorry about that, I did not know.

Thank you!

XL2

  • Sr. Member
  • ****
  • Posts: 341
  • Karma: +72/-1
    • View Profile
Re: Model converter (.ZTP) -0.1 - WIP
« Reply #25 on: June 19, 2018, 03:11:51 pm »
Yes, I could probably clean up the interface to make it easier to understand.
The interpolation on the converter and in the animation player are different thing, I should just call it "skip frames" or something like that to make it easier to understand (I just changed my interpolation technique as I wrote the demo).

ponut64

  • Full Member
  • ***
  • Posts: 175
  • Karma: +13/-0
    • View Profile
Re: Model converter (.ZTP) -0.1 - WIP
« Reply #26 on: June 19, 2018, 03:34:30 pm »
Well, it does make sense when one considers the way how Blender exports OBJ files when you tick "Animation" in the export parameters.

The way the program actually does it, though, is a lot better and I am glad that's available.

XL2

  • Sr. Member
  • ****
  • Posts: 341
  • Karma: +72/-1
    • View Profile
Re: Model converter (.ZTP) -0.1 - WIP
« Reply #27 on: June 19, 2018, 08:11:18 pm »
I'm still really surprised at how good interpolation looks like.
It feels very smooth and decompressing the data isn't as slow as I thought it would be.
I could probably speed it up at a later time by using assembly.
So I don't think I will be spending time on trying to figure out the DAE file format and I will stick to OBJ for now as vertex animation is quite simple yet it allows very complex motions.

ponut64

  • Full Member
  • ***
  • Posts: 175
  • Karma: +13/-0
    • View Profile
Re: Model converter (.ZTP) -0.1 - WIP
« Reply #28 on: June 21, 2018, 05:36:42 pm »
Hey,

Sorry to bug you again sir, but I have some more questions.

I got your Sonic ZTP and animation to load and play in my environment (which should be a no-brainer because that's all files and code that your wrote), but there seems to be something wrong with my Blender or OBJ files or.. something.

I have tried a couple of different things (certainly not exhaustive, however) and it all seems to end in vomit (once using the animation play function):
https://i.imgur.com/pXOdV5x.png?1
I did however re-convert your OBJ files using the tools with some different parameters and it did work, so I feel like I know how to type things in. Possibly.
I wonder, am I misinterpreting what this tool is for? Does this compress mesh-is-a-bone animation or per vertex animations?
(Looking at your Blender file, per vertex animation is clearly used so I don't know why I even ask)
« Last Edit: June 21, 2018, 05:39:45 pm by ponut64 »

XL2

  • Sr. Member
  • ****
  • Posts: 341
  • Karma: +72/-1
    • View Profile
Re: Model converter (.ZTP) -0.1 - WIP
« Reply #29 on: June 21, 2018, 05:42:01 pm »
It compresses animations (interpolation ) and vertices (12 to 6 bytes).
You should try to scale down your model to see if it works (I'm sure it will).
That's one issue since I only keep a 7.9 fixed point instead of 16.16.
In other words, if you want a different ratio, you will have to play with the source code.
You can't really avoid loss of precision, so it's all about choosing what you need.

 

Sitemap 1 2 3 4 5 6 7 8 9 10 
SMF spam blocked by CleanTalk