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 > SH5 Mods Workshop
Forget password? Reset here

Reply
 
Thread Tools Display Modes
Old 03-06-13, 06:47 PM   #1921
Ekmek
Mate
 
Join Date: Nov 2011
Posts: 53
Downloads: 4
Uploads: 0
Default

Quote:
Originally Posted by TheDarkWraith View Post
That montezuma.GR2 is a doozy Most of the 'rules' I thought I knew just got shattered by it It exposed a new datatype in the datatype definitions - granny_real16 so that's a positive. It'll take me some time to analyze this and make the necessary changes I've already made a few that were easy to do. This granny_real16 though is something I was hoping I would never see

ouch! I got faith in you man!
Ekmek is offline   Reply With Quote
Old 03-06-13, 07:01 PM   #1922
TheDarkWraith
Black Magic
 
Join Date: Jun 2007
Posts: 11,959
Downloads: 147
Uploads: 5


Default

Quote:
Originally Posted by Ekmek View Post
ouch! I got faith in you man!
It's not that bad. The hardest part was finding a float16 data type. C# doesn't define that value type but DirectX does: Microsoft.DirectX.Single16 Since I'm already using DirectX for the rendering it's a no problem
TheDarkWraith is offline   Reply With Quote
Old 03-07-13, 12:53 PM   #1923
TheDarkWraith
Black Magic
 
Join Date: Jun 2007
Posts: 11,959
Downloads: 147
Uploads: 5


Default

v1.1.371.1 released. See post #1

You need to upgrage to this version if you are using older versions. This version fixes some inconsistencies found in the app while trying to load the montezuma GR2 file (this file exposed some problems I wasn't aware of!)

This version also lets you delete transformtracks from a trackgroup. The transformtrack(s) in conjuction with an animation is what lets animation happen. The animation will define the trackgroup(s) it is tied to.

I still haven't figured out how the transform track(s) cause animation. I'm thinking that they are defining bezier curves but not 100% sure yet

You still won't be able to open any GR2 file that contains granny_real16 values yet (montezuma). I'm still coding that in
TheDarkWraith is offline   Reply With Quote
Old 03-07-13, 03:33 PM   #1924
TheDarkWraith
Black Magic
 
Join Date: Jun 2007
Posts: 11,959
Downloads: 147
Uploads: 5


Default

just finished updating the app so that it can handle any granny_real16 value in the vertex data. Was able to read in all the montezuma's vertex data with no issues

Now just have to update the app to handle granny_real16 indices
TheDarkWraith is offline   Reply With Quote
Old 03-07-13, 04:03 PM   #1925
Ekmek
Mate
 
Join Date: Nov 2011
Posts: 53
Downloads: 4
Uploads: 0
Default

wow, that was quick!
Ekmek is offline   Reply With Quote
Old 03-07-13, 07:54 PM   #1926
TheDarkWraith
Black Magic
 
Join Date: Jun 2007
Posts: 11,959
Downloads: 147
Uploads: 5


Default

Coded in the reading of 16 bit indices. App is really coming along now



Now there is a wide range of GR2 files it can open. Should only be a limited few it will have problems with.

The granny_real16 is still a little problem. I can read them no problem. The problem is when it comes time to write them. I read the granny_real16 values as 16 bit values but then cast them to 32 bit floats internally (actually I read the 2 bytes that make up the granny_real16 value then pass this to a function that converts the 2 bytes to a float value). This way I didn't have to make tons of internal code changes. It also helped because there would be a big problem with VertexDeclarations because they don't have a type that describes 3 float16 values.

What I'm thinking about doing is converting any granny_real16 values to granny_real32 values. This will increase the file size but it's all I can do until I can find a way to convert a float (4 bytes) into a 16 bit float. Microsoft DirectX's 16 bit float is useless - you can't use a BinaryWriter to write it nor can you cast it to anything. Does anyone know of any code that will convert a float (or single or double) to a 16 bit value Obviously there is a way to do it because the granny_real16 value exists in the GR2 file

Also made a code change in regards to a mesh's visibility. If the mesh has more than 1 bone binding then the app will set the visibility of the mesh to visible. Most of these GR2 files outside of SH5 don't have the same extendeddata for the bones that specifies it's visibility.
TheDarkWraith is offline   Reply With Quote
Old 03-07-13, 10:36 PM   #1927
TheDarkWraith
Black Magic
 
Join Date: Jun 2007
Posts: 11,959
Downloads: 147
Uploads: 5


Default

v1.1.374.1 released. See post #1

The app will now let you load a GR2 file that has 16 bit values

If the app has 16 bit values it is locked out from doing many things. Basically you can view the GR2 file and you can export from it. You cannot import into it or do anything that would change the file structure (you are totally locked out from saving it). Reason is I haven't finished coding that part that deals with writing 16 bit values yet.

TheDarkWraith is offline   Reply With Quote
Old 03-08-13, 09:33 AM   #1928
TheDarkWraith
Black Magic
 
Join Date: Jun 2007
Posts: 11,959
Downloads: 147
Uploads: 5


Default

after much searching I finally found a class for C# that works with 16 bit floats No longer need to convert 16 bit vertex data to 32 bit. I can now write 16 bit floats Internally the app uses 32 bit data for vertex data and indices (if they are 16bit in the GR2 file they are read as a 16bit value but then converted to 32bit) but when it comes time to write the data it will convert the necessary data on the fly back to 16 bit before writing.

TheDarkWraith is offline   Reply With Quote
Old 03-08-13, 11:58 AM   #1929
Ekmek
Mate
 
Join Date: Nov 2011
Posts: 53
Downloads: 4
Uploads: 0
Default

Nice! This thing is really coming along. I still need to learn my way around it though.
Ekmek is offline   Reply With Quote
Old 03-08-13, 12:06 PM   #1930
TheDarkWraith
Black Magic
 
Join Date: Jun 2007
Posts: 11,959
Downloads: 147
Uploads: 5


Default

Quote:
Originally Posted by Ekmek View Post
Nice! This thing is really coming along. I still need to learn my way around it though.
It's maturing quite nicely.

Just found a critical error in the app. I removed the download link in post #1.

DO NOT IMPORT ANYTHING USING CURRENT VERSION POSTED AT POST #1 OR ANY OTHER EARLIER VERSIONS

The critical error is if the vertex data contains DiffuseColor0 data I'm presently not accounting for that when I allocate space for additional vertices in the GR2 file. This, of course, will totally corrupt the mesh data in the GR2 file. If the vertex data doesn't contain a DiffuseColor0 component then everything is fine.

I'm working on the error currently.

I've also discovered another critical error in the app that was exposed by the montezuma GR2 file. When I would allocate/deallocate space for indices/vertices the app was not checking to ensure they were properly aligned to the section's alignment value. This will also corrupt the GR2 file.

Live and learn The more files I try to open with the app the more I learn and the more robust the app becomes.

I will post a new version when the errors have been fixed.
TheDarkWraith is offline   Reply With Quote
Old 03-08-13, 12:21 PM   #1931
gap
Navy Seal
 
Join Date: Jan 2011
Location: CJ8937
Posts: 8,160
Downloads: 793
Uploads: 10
Default

Quote:
Originally Posted by TheDarkWraith View Post
I will post a new version when the errors have been fixed.
Looking forward to it
gap is offline   Reply With Quote
Old 03-08-13, 12:26 PM   #1932
Targor Avelany
Ace of the Deep
 
Join Date: Jan 2010
Location: Vancouver, BC, Canada
Posts: 1,183
Downloads: 225
Uploads: 0


Default

Quote:
Originally Posted by TheDarkWraith View Post
It's maturing quite nicely.

Just found a critical error in the app. I removed the download link in post #1.

DO NOT IMPORT ANYTHING USING CURRENT VERSION POSTED AT POST #1 OR ANY OTHER EARLIER VERSIONS

The critical error is if the vertex data contains DiffuseColor0 data I'm presently not accounting for that when I allocate space for additional vertices in the GR2 file. This, of course, will totally corrupt the mesh data in the GR2 file. If the vertex data doesn't contain a DiffuseColor0 component then everything is fine.

I'm working on the error currently.

I've also discovered another critical error in the app that was exposed by the montezuma GR2 file. When I would allocate/deallocate space for indices/vertices the app was not checking to ensure they were properly aligned to the section's alignment value. This will also corrupt the GR2 file.

Live and learn The more files I try to open with the app the more I learn and the more robust the app becomes.

I will post a new version when the errors have been fixed.
Hahahahaha!!! Every single time I'm getting close to finishing my lifeboat model and importing it and adjusting the bones, something like this happens )))))

Glad that the app is maturing pretty well! You are doing some amazing job, TDW!

Just funny how it works out
Targor Avelany is offline   Reply With Quote
Old 03-08-13, 12:37 PM   #1933
TheDarkWraith
Black Magic
 
Join Date: Jun 2007
Posts: 11,959
Downloads: 147
Uploads: 5


Default

Quote:
Originally Posted by Targor Avelany View Post
Hahahahaha!!! Every single time I'm getting close to finishing my lifeboat model and importing it and adjusting the bones, something like this happens )))))

Glad that the app is maturing pretty well! You are doing some amazing job, TDW!

Just funny how it works out
Lifeboat is fine. It doesn't have DiffuseColor0 defined You are safe.
TheDarkWraith is offline   Reply With Quote
Old 03-08-13, 01:31 PM   #1934
TheDarkWraith
Black Magic
 
Join Date: Jun 2007
Posts: 11,959
Downloads: 147
Uploads: 5


Default

Just tested all the new code for ensuring indices and vertices are aligned to the section's alignment value on the lifeboat and all went well. Now to test the montezuma file. If it can make it through it we should be good
TheDarkWraith is offline   Reply With Quote
Old 03-08-13, 02:36 PM   #1935
Targor Avelany
Ace of the Deep
 
Join Date: Jan 2010
Location: Vancouver, BC, Canada
Posts: 1,183
Downloads: 225
Uploads: 0


Default

Quote:
Originally Posted by TheDarkWraith View Post
Just tested all the new code for ensuring indices and vertices are aligned to the section's alignment value on the lifeboat and all went well. Now to test the montezuma file. If it can make it through it we should be good
Targor Avelany is offline   Reply With Quote
Reply

Thread Tools
Display Modes

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 04:56 PM.


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