SUBSIM Radio Room Forums



SUBSIM: The Web's #1 resource for all submarine & naval simulations since 1997

Go Back   SUBSIM Radio Room Forums > Silent Hunter 3 - 4 - 5 > SHIII Mods Workshop
Forget password? Reset here

Reply
 
Thread Tools Display Modes
Old 08-13-07, 12:19 AM   #1
TheDarkWraith
Black Magic
 
Join Date: Jun 2007
Posts: 11,962
Downloads: 147
Uploads: 5


Default [WIP] Silent Animator

I was having trouble resizing the flag in my flag mod and seeing the animations so after some time of hammering out where the animations were, their size, how many keyframes, timing, etc. I wrote a little app to import/export each keyframe of the animations to view. This app also lets you adust the base mesh vertices and the timing of the individual keyframes. It's still a WIP and I have to finish the import/export of the keyframes still. I also need to find a way of converting to/from integers to Float32 in Visual Basic, can anyone give me some pointers here?
You first load in the .obj file from a previous Pack3D export. You then open up the .dat file containing the animations and the app takes the ID from the .obj file and searches for the type A/5 node containing this ID as the parent ID in the .dat file. It then determines the animation ID from this and deciphers the type 6/0 node with the animation ID and stores all the timings and keyframes data.
Soon to be coded will be the exporting/importing ability of the keyframes. What I intend to do is you pick a keyframe and push the export button and it writes a .obj file with this keyframe data. You then edit this .obj in Wings3D or whatever and when you're finished you import it back into the app. Currently the app lists the number of keyframes found only.
The timings code is already complete except for conversions from Integer to Float32 and back (currently all values are in Integer format). You can view and edit all the timing information found for that ID.
The app also contains a running history block so that you can view everything that has taken place in case you need to make corrections. You have the ability to save this history file.

Here's a screenie of it so far:




Racerboy
TheDarkWraith is offline   Reply With Quote
Old 08-13-07, 01:03 AM   #2
wildchild
Chief
 
Join Date: Aug 2006
Location: some where in the deep blue sea
Posts: 318
Downloads: 0
Uploads: 0
Default

not bad hope it works for you
__________________
come one and all stand together and fight from the deep
CLICK HERE
wildchild is offline   Reply With Quote
Old 08-13-07, 03:42 AM   #3
JScones
Navy Seal
 
Join Date: Apr 2005
Posts: 5,501
Downloads: 19
Uploads: 0
Default

Quote:
Originally Posted by Racerboy
I also need to find a way of converting to/from integers to Float32 in Visual Basic, can anyone give me some pointers here?
Type conversion is a very fundamental part of programming, in any language. A quick google will tell you all you need to know, let alone looking at your VB help file. However, on the assumption that this tool will be helpful to other modellers, here's something to get you started:

In VB6 and VB .NET:
float (or any numeric type, boolean, string or object) to integer: intval = CInt(fltval)
integer (or any numeric type, boolean, string or object) to float32: sngval = CSng(intval)

Alternatively for better performance in VB .NET (but to the detriment of locale setting consideration, albeit not an issue here):
float to integer: intval = [System.]Convert.ToInt32(fltval)
integer to float32: sngval = [System.]Convert.ToSingle(intval)

You can now search your VB help file for other conversion keywords/methods.

Of course, converting a float to an integer and then back to a float again will give you a different result to what you started with.

Also, VB will implicitly convert from integer to float, but avoid this. It's sloppy coding and one of many things that sets VB apart from other more "strongly typed" languages. Always use Option Explicit and Option Strict to minimise variable/object related errors arising from typos and conversions.
JScones is offline   Reply With Quote
Old 08-14-07, 12:22 AM   #4
TheDarkWraith
Black Magic
 
Join Date: Jun 2007
Posts: 11,962
Downloads: 147
Uploads: 5


Default

ok all, this IS HUGE!!! I got the export function complete in Silent Animator and was able to extract all 25 keyframes that make the flag animate!! They were extracted from the DAT file. Here is a screenshot showing what all 25 animation frames look like. They go in order from left to right (1-25):



A BIG thanks to JScones for giving me a little info and pointers for the stump I was in.
Does anyone realize what the potential of this is???? We should be able to create/modify animations now.
I have to code the import function for this yet but I'm amazed myself at what this app can do that I have created - it actually worked

Racerboy
TheDarkWraith is offline   Reply With Quote
Old 08-14-07, 01:41 AM   #5
Hunter
Commander
 
Join Date: Mar 2006
Location: St.Petersburg, Russia
Posts: 474
Downloads: 166
Uploads: 0
Default

Is it possible to do something with animation of the trap container?
Hunter is offline   Reply With Quote
Old 08-14-07, 06:50 AM   #6
ref
Grey Wolf
 
Join Date: Nov 2005
Location: Mar del Plata, Argentina
Posts: 871
Downloads: 0
Uploads: 0
Default

Quote:
Originally Posted by Racerboy
ok all, this IS HUGE!!! I got the export function complete in Silent Animator and was able to extract all 25 keyframes that make the flag animate!!
Very good work Racerboy , now we are talking...

Ref
__________________
ref is offline   Reply With Quote
Old 08-14-07, 08:51 AM   #7
TheDarkWraith
Black Magic
 
Join Date: Jun 2007
Posts: 11,962
Downloads: 147
Uploads: 5


Default

Quote:
Originally Posted by Hunter
Is it possible to do something with animation of the trap container?
What DAT file is it located in? I'll extract it and see what the animation frames look like and post a screenie.
TheDarkWraith is offline   Reply With Quote
Old 08-14-07, 09:20 AM   #8
TheDarkWraith
Black Magic
 
Join Date: Jun 2007
Posts: 11,962
Downloads: 147
Uploads: 5


Default

There's one missing piece to the puzzle and a couple of assumptions that I made that I would like to run by everyone in the hopes that someone has the answer. Given this:

06 00 00 00 00 00 00 00 7E 2A 00 00 B1 D7 95 73
7E 24 7B 01
00 00 00 00 00 00 00 00 05 00 19 00
00 00 00 00 00 00 AB AA AA 3D 01 00


06 00 00 00 00 00 00 00 = Type 6/0 node (animation)
7E 2A 00 00 = size of this node
B1 D7 95 73 7E 24 7B 01 = Node ID
00 00 00 00 00 00 00 00 = 3D Model ID
05 00 = ??????? ( I haven't figured this missing piece of the puzzle out )
19 00 = Number of Timings (I'm assuming this is a 2 byte value and not 4 because of next)
00 00 00 00 = Float value for Timing #0x0 (I'm assuming this is Timing #0)
00 = Tag for Timing #0x0
00 = Seperation byte between timings
AB AA AA 3D = Float value for Timing #0x1
01 = Tag for Timing #0x1
00 = Seperation byte between timings
and it repeats the above 4 until Timing #0x18 which shows:

AB AA 02 40 17 00 00 00 08 40 18 00 19 00 00 00
D2 00 00 00 3B C5 EC 36 DA FE A0 3D 7F 7F 7F 7F
FE 7F

AB AA 02 40 = Float value for Timing #0x17
17 = Tag for Timing #0x17
00 = Seperation byte between timings
00 00 08 40 = Float value for Timing #0x18 (since zero based from my assumption above this is the last timing value)
18 = Tag for Timing #0x18 (last timing value)
00 = Seperation byte between timings
19 00 00 00 = Number of KeyFrames
D2 00 00 00 = KeyFrame size

And then the rest of the hex deals with the hard coded animation keyframes. I just need to figure out this last remaining piece of the puzzle to decode this entire 6/0 node. I'm hoping someone has the answer or can figure it out
TheDarkWraith is offline   Reply With Quote
Old 08-14-07, 09:31 AM   #9
mkubani
Lieutenant
 
Join Date: Apr 2005
Posts: 256
Downloads: 0
Uploads: 0
Default

Sounds good! Good luck!!!
mkubani is offline   Reply With Quote
Old 08-14-07, 01:02 PM   #10
VipertheSniper
Ace of the Deep
 
Join Date: Sep 2002
Location: Austria
Posts: 1,074
Downloads: 0
Uploads: 0
Default

Quote:
Originally Posted by Racerboy
There's one missing piece to the puzzle and a couple of assumptions that I made that I would like to run by everyone in the hopes that someone has the answer. Given this:

06 00 00 00 00 00 00 00 7E 2A 00 00 B1 D7 95 73
7E 24 7B 01
00 00 00 00 00 00 00 00 05 00 19 00
00 00 00 00 00 00 AB AA AA 3D 01 00


06 00 00 00 00 00 00 00 = Type 6/0 node (animation)
7E 2A 00 00 = size of this node
B1 D7 95 73 7E 24 7B 01 = Node ID
00 00 00 00 00 00 00 00 = 3D Model ID
05 00 = ??????? ( I haven't figured this missing piece of the puzzle out )
19 00 = Number of Timings (I'm assuming this is a 2 byte value and not 4 because of next)
00 00 00 00 = Float value for Timing #0x0 (I'm assuming this is Timing #0)
00 = Tag for Timing #0x0
00 = Seperation byte between timings
AB AA AA 3D = Float value for Timing #0x1
01 = Tag for Timing #0x1
00 = Seperation byte between timings
and it repeats the above 4 until Timing #0x18 which shows:

AB AA 02 40 17 00 00 00 08 40 18 00 19 00 00 00
D2 00 00 00 3B C5 EC 36 DA FE A0 3D 7F 7F 7F 7F
FE 7F

AB AA 02 40 = Float value for Timing #0x17
17 = Tag for Timing #0x17
00 = Seperation byte between timings
00 00 08 40 = Float value for Timing #0x18 (since zero based from my assumption above this is the last timing value)
18 = Tag for Timing #0x18 (last timing value)
00 = Seperation byte between timings
19 00 00 00 = Number of KeyFrames
D2 00 00 00 = KeyFrame size

And then the rest of the hex deals with the hard coded animation keyframes. I just need to figure out this last remaining piece of the puzzle to decode this entire 6/0 node. I'm hoping someone has the answer or can figure it out
This just a guess, as I've absolutely no modding experience whatsoever, but is the animation speed determined through any of those values? If not maybe those magenta colored numbers set the animation speed?
VipertheSniper is offline   Reply With Quote
Old 08-14-07, 01:21 PM   #11
TheDarkWraith
Black Magic
 
Join Date: Jun 2007
Posts: 11,962
Downloads: 147
Uploads: 5


Default

The animation speed through the KeyFrames is determined by each KeyFrame's timing value. That is the xx xx xx xx float value followed by the xx timing number followed by the 00 seperation byte.
That 05 00 still has me stumped....
TheDarkWraith is offline   Reply With Quote
Old 08-14-07, 01:35 PM   #12
ref
Grey Wolf
 
Join Date: Nov 2005
Location: Mar del Plata, Argentina
Posts: 871
Downloads: 0
Uploads: 0
Default

Quote:
Originally Posted by Racerboy
00 = Tag for Timing #0x0
00 = Seperation byte between timings
I think that you can probably join those two instead of two 1 byte values use a word (two byte integer) for the keyframe number.

How did you convert the word values of the vertices that follow to floats ?

Ref
__________________
ref is offline   Reply With Quote
Old 08-14-07, 01:50 PM   #13
TheDarkWraith
Black Magic
 
Join Date: Jun 2007
Posts: 11,962
Downloads: 147
Uploads: 5


Default

Quote:
Originally Posted by ref
Quote:
Originally Posted by Racerboy
00 = Tag for Timing #0x0
00 = Seperation byte between timings
I think that you can probably join those two instead of two 1 byte values use a word (two byte integer) for the keyframe number.

How did you convert the word values of the vertices that follow to floats ?

Ref
Ref,

You are probably correct, the designers may have given the Timing Tags two bytes. I'll change Silent Animator to look for two bytes for the Timing Tags.
At the start of each keyframe there are two floats. The first float is the scale value, the second float is the offset value. What follows them are the vertices: two bytes for vertice x, two bytes for vertice y, and two bytes for vertice z. This is repeated for x amount of vertices.
I'll use vertice x as an example:

take the two bytes for vertice x and convert them to an UInt16 value
Multiply this by the float value of the first float in the keyframe
add the second float value of the keyframe to this
you now have the float32 value for this vertice

now do this for all the axis's of the vertices, for every vertice in that keyframe, then for every keyframe for that node. Hence why I made Silent Animator

Racerboy
TheDarkWraith is offline   Reply With Quote
Old 08-14-07, 03:05 PM   #14
ref
Grey Wolf
 
Join Date: Nov 2005
Location: Mar del Plata, Argentina
Posts: 871
Downloads: 0
Uploads: 0
Default

Thanks for the tip, that's a very good catch, I've looked at the animations a long time ago, but never had the time to investigate in deep due to the amount of work with GWX.

Ref
__________________
ref is offline   Reply With Quote
Old 08-14-07, 04:50 PM   #15
Anvart
Admiral
 
Join Date: Jan 2006
Location: Russia ®
Posts: 2,492
Downloads: 122
Uploads: 1
Default

Quote:
Originally Posted by Racerboy
The animation speed through the KeyFrames is determined by each KeyFrame's timing value. That is the xx xx xx xx float value followed by the xx timing number followed by the 00 seperation byte.
That 05 00 still has me stumped....
Animation type ...
__________________
Alex ®


Moses said: "Don't create yourself an idol"...
Anvart is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 01:07 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright © 1995- 2025 Subsim®
"Subsim" is a registered trademark, all rights reserved.