March 28, 2024, 03:16:29 PM

Username
Password

Pages: 1 ... 6 7 [8]   Go Down
Print
Author Topic: Portrait meshes  (Read 138184 times)
0 Members and 1 Guest are viewing this topic.
devast3d
Developer
*
Offline Offline

Posts: 31


View Profile
« Reply #105 on: February 07, 2019, 10:40:36 AM »

Something is really wrong with the animation interpolation in DO.

By using the KEY data and simply interpolating between the keys with linear interpolation sometimes the animation doesn't reach the same positions as in DO. So either we got KEY data extraction wrong (don't think so) or DO devs did something crazy with the interpolation.

I've tried to apply overshooting when interpolating, i.e. instead of interpolating between two keys using 0.0-1.0 factor, interpolation is done in 0.0-1.X factor, i.e. 1.0-1.2. In effect this creates some exaggeration of the movement. Actually, this worked in some cases! And I've finally reached the same pose as in DO for e.g. 01 animation in 1.seq file. It doesn't work the same for all animations though.

Another very interesting observation. I've taken 0 animation from 1.seq (charge). It contains the same 03 commands

13 04 14 04
03 04 0A 0A
01 05 00 00
0A 03 00 00
03 00 0A 0A
02 00 00 00
08 00 00 00

notice, two 03 commands have the same 0A key! The only difference is in 04/00 byte (we know this somehow affects interpolation). Observing charge portrait animation in DO I can see that there slight movement in the end of the animation (though the position shoud be the same!).

So I did some testing. I've copied last 03 command and pasted it many times. Got following results in DO:
- animation is NOT static on these copied keys, I still see small movement (really small but noticeable)
- depending on 00/04 byte the movement is either constantly periodic or fading away slightly

And if I can somehow understand the fading case, I really don't get how can one get non fading movement between the same keys!! Even when using overshooting of some sort. It's like they have some sort of acceleration applied (which is also non-sense since the positions are the same). Another DO dark magic...
Logged
devast3d
Developer
*
Offline Offline

Posts: 31


View Profile
« Reply #106 on: February 08, 2019, 11:31:27 AM »

After toying with SEQ a bit more I think they're using some kind of spline interpolation between the frames.

Rationale:

I've taken 1 sequence from 1.SEQ file (enemy sighted)

13 04 01 04
03 04 05 06
03 04 19 02
0A 01 00 00
02 00 00 00
08 00 00 00

Here we have 3 animation keys: 13->03->03

If interpolated linearly the animation never reaches the same position on the first 03 command as in DO (stopping much earlier). This is where I thought there's some kind of overshooting applied. So I nuked second 03 command from the sequence, leaving only 2 animation keys. Playing this sequence in DO resulted in unexpected (at least for me) result: the animation stopped at the same position as in my program! There was no overshooting at all.

After that I think there's some spline interpolation applied. Tried Catmull-Rom spline interpolation today (different parameterizations, including most famous uniform, centripetal, chordal), but it didn't overshoot at all. Moreover, this spline type requires at least 4 points (and SEQ animation can have just 2, like e.g. "all is lost", 6 in 1.SEQ), so I had to duplicate and jitter end points to make it work. Probably other spline type is used in DO, going to try...
Logged
olly
Global Spokesperson
*
Offline Offline

Posts: 2268



View Profile
« Reply #107 on: February 08, 2019, 11:16:31 PM »

Good work

Smiley
Logged

and back in Nuln, the ageing Graf Berhardt smiled his secret smile of pride whenever he heard the latest tales of his eldest son's ever growing chain of glorious victories -(sothr manual)
devast3d
Developer
*
Offline Offline

Posts: 31


View Profile
« Reply #108 on: February 09, 2019, 07:28:15 PM »

Decided to move the experiments to the external 3d editor since I'm out of ideas.

Here're two options that I've tried (on the images you see x/y/z rotation channels):

* curve_normal.jpg (268.44 KB. 1255x878 - viewed 610 times.)


* curve_smooth.jpg (252.28 KB. 1140x879 - viewed 594 times.)


First one looks similar to what I get in UE. On the second curve we see substantial overshooting and this looks like something DO uses (not exactly the same but in the same direction)! So the task is to find how DO devs calculated this curve (and tangents on the keys).

p.s. 03 00 XX XX overshoots much more than 03 04 XX XX command. Probably they differ either in curve type or in tangents of the same curve.


« Last Edit: February 09, 2019, 07:36:07 PM by devast3d » Logged
olly
Global Spokesperson
*
Offline Offline

Posts: 2268



View Profile
« Reply #109 on: February 10, 2019, 04:56:24 PM »

Forgive my novice knowledge but I've only ever used bezier interpolation that makes the graph ease in and ease out on a smooth graph curve, for Blender animations.
« Last Edit: February 10, 2019, 05:18:39 PM by olly » Logged

and back in Nuln, the ageing Graf Berhardt smiled his secret smile of pride whenever he heard the latest tales of his eldest son's ever growing chain of glorious victories -(sothr manual)
devast3d
Developer
*
Offline Offline

Posts: 31


View Profile
« Reply #110 on: February 11, 2019, 10:44:02 PM »

Ended up using TCB splines (https://en.wikipedia.org/wiki/Kochanek%E2%80%93Bartels_spline). Modifying tension and bias gives DO-like look. Used different sets for 0304 and 0300 commands. Not exactly the same as in DO, but looks pretty good.

Going to end curve research here due to lack of time. Moving to eyes/mouth animation.
Logged
olly
Global Spokesperson
*
Offline Offline

Posts: 2268



View Profile
« Reply #111 on: February 12, 2019, 12:14:47 AM »

Yep it looks really good - well done and was also great learning for me, thanks.
Logged

and back in Nuln, the ageing Graf Berhardt smiled his secret smile of pride whenever he heard the latest tales of his eldest son's ever growing chain of glorious victories -(sothr manual)
devast3d
Developer
*
Offline Offline

Posts: 31


View Profile
« Reply #112 on: February 13, 2019, 11:08:18 AM »

A bit fixed seqreplaceui tool. Added proper vertical scrolling, otherwise you can't normally view/edit 126.seq/127.seq files (mouth animations).
* seqreplaceui.exe (18 KB - downloaded 296 times.)


These files are of the strange structure. They got many sequences, but only few of them contain data, other only contain single 08 command.

126.seq file:
Contains 32 sequences in total. Only sequences 0, 1, 2, 3 and 17 contain data. Sequences 0 and 17 contain 05 (eyes) commands and 06 (mouth) commands. The rest contain only 06 commands.

127.seq file:
16 in total, 0-4 contain data. Only contain 06 commands.

Most of the sequnces only contain 0A command with 00-03 index, however 9 sequence also contains 0A 04 which makes me think these seqs use 127 file for the mouth animation. Gonna try this file first.

The 0A command itself is very simple:

0A XX 00 00

where XX is the mouth index. There are 5 indices in total:

00 10
01 11
02

they correspond to the column/row of the mouth inside the bits texture.

To obtain the row/column one can easily do this:

uint8 col = (state & 0xF0) >> 4;
uint8 row =  state & 0x0F;

What's bothering me is that there's no time in either 0A or 06 commands. So it's probably hardcoded somewhere.


* mouth.jpg (96.83 KB. 603x822 - viewed 584 times.)

* seqreplaceui.exe (18 KB - downloaded 296 times.)
Logged
devast3d
Developer
*
Offline Offline

Posts: 31


View Profile
« Reply #113 on: February 13, 2019, 12:56:41 PM »

Here're several examples of what the code currently produces. All looks good so far. I think this is OK and I can stop portrait work here. Going to merge the code into DOR now.

* port_charge.mp4 (135.14 KB - downloaded 318 times.)

* port_enemysighted.mp4 (186.76 KB - downloaded 311 times.)

* port_allislost.mp4 (135.26 KB - downloaded 305 times.)


p.s. Had to switch to nearest filtration (pixel look) due to DO portrait textures are unfriendly to bilinear.

* port_charge.mp4 (135.14 KB - downloaded 318 times.)
* port_enemysighted.mp4 (186.76 KB - downloaded 311 times.)
* port_allislost.mp4 (135.26 KB - downloaded 305 times.)
Logged
olly
Global Spokesperson
*
Offline Offline

Posts: 2268



View Profile
« Reply #114 on: February 13, 2019, 11:07:25 PM »

Very nice!

Smiley
Logged

and back in Nuln, the ageing Graf Berhardt smiled his secret smile of pride whenever he heard the latest tales of his eldest son's ever growing chain of glorious victories -(sothr manual)
devast3d
Developer
*
Offline Offline

Posts: 31


View Profile
« Reply #115 on: February 19, 2019, 11:24:47 AM »

Regarding b101 mission anims: "get the loot" and "they're heading to the trading post..."

- "get the loot" Uses 9 anim from the 2.seq (ngobs use 2.seq and 9th anim seems to be reserved for such cases)
- "they're heading..." uses 9 anim from the 1.seq
- these sequences are completely the same in terms of commands, but use different key files obviously
- the most interesting thing: while "get the loot" is very short, "they're heading..." is rather long (but commands are the same!). I think this is overriden by special flag of some sort, which tells the animation to stop when sound stops (if I remove 0A command from 2.seq, I see full sequence, not the short one!)
- both use 127.seq for the facial animation, however, 0A 04 command that's used is rather short, but in "they're heading..." the mouth animation looks much longer. I think this is another override: loop the 0A command while animation is playing. Proof: I've pasted 05 00/01 commands inside facial animation and Morgan was constantly opening/closing his eyes while "they're heading blablabla"
Logged
Pages: 1 ... 6 7 [8]   Go Up
Print
Jump to: