Special Aircraft Service

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 3 4 5 [6] 7 8 9 ... 50   Go Down

Author Topic: msh Binary format  (Read 109363 times)

0 Members and 9 Guests are viewing this topic.

the_woz

  • Modder
  • member
  • Offline Offline
  • Posts: 48
    • solistate
Re: msh Binary format
« Reply #60 on: April 10, 2014, 07:51:35 PM »

Just noticed this thread
I wrote a msh importer for blender and started by decompiling the 3ds max buggy buggy importer. It's not bug free but helps a lot.

One plane I had problems while writing my importer was the P.11c, it uses a data type for vertex (IIRC) not used in most of the other meshes in game.
Logged

Stainless

  • Modder
  • member
  • Offline Offline
  • Posts: 1534
Re: msh Binary format
« Reply #61 on: April 11, 2014, 02:28:29 AM »

They use a three byte float for a lot of variables (in binary mode of course  ;D)

Code: [Select]
        private float ReadTriple(BinaryReader b)
        {
            float res = 0;
            int a1 = b.ReadByte();
            int a2 = b.ReadByte();
            int a3 = b.ReadByte();
            int a4 = 0;
            if ((a3 & 128) != 0)
                a4 = 255;
            a3 = (a4 << 24) + (a3 << 16) + (a2 << 8) + a1;
            res = (float)a3 / 65536.0f;
            return res;
        }

To work out which format a float is in you look at the table stored earlier in the file. Each entry is of the following format and the type entry is the key.

Code: [Select]
    public struct T1Entry
    {
        public Int32 Offset;
        public Int32 StartRecord;
        public Int16 NumberOfRecords;
        public Int16 Type;
    };

Type 1 or 0x101  is a byte accumulator
Type 2 or 0x202  is a short accumulator

You also have to look at the section size stored in table 3. 24 is used for 6 floats, 18 is used for 6 triples.

That may be what tripped you up.


Logged

Blazing

  • Harbour Master
  • Modder
  • member
  • Offline Offline
  • Posts: 572
Re: msh Binary format
« Reply #62 on: April 11, 2014, 04:23:57 AM »

are these boxes like the folding wings mean it will like play the say the wing folding option. if yes that would be so good.
Logged

Stainless

  • Modder
  • member
  • Offline Offline
  • Posts: 1534
Re: msh Binary format
« Reply #63 on: April 11, 2014, 06:06:06 AM »

Yes I plan to code all those options, I've just completed shoot mode.

In normal mode clicking on the 3d display moves the camera, in shoot mode it does a ray triangle collision check against the collision mesh. Drawing a small particle effect on a hit.

I'm going to then use this to activate the damage meshes, when I get chance.

Logged

Stainless

  • Modder
  • member
  • Offline Offline
  • Posts: 1534
Re: msh Binary format
« Reply #64 on: April 11, 2014, 08:04:54 AM »

I've just had a look at the HE-280 and it thrown me a lot.

In CF_D0.msh everything looks fine except that just before the shadow verts you have the collision mesh. That's not what I was expecting, but it's not a problem. My code can handle that.

However, after the shadow I get another copy of the collision mesh. My code cannot handle that!

Is that something that can happen and is valid? Or is it a problem with the mesh?
Logged

SAS~Loku

  • SAS Team
  • member
  • Offline Offline
  • Posts: 662
Re: msh Binary format
« Reply #65 on: April 11, 2014, 08:41:26 AM »

Modders/3d guys use tools the were made using reverse engineering to create them, first:Buggy Buggy Importer/Exporter, easy to use but has a problem with saving smoothing groups correctly, compatible with both Gmax and 3dmax and another: Maraz il2 exporter, more complex, compatible only with 3d max.Use of these modded aircraft is not good idea, some of them in terms of quality dont differ from stock ones, but some made by modders with less experience may have bugs on the 3d level, like the one you`v just encountered and they may cause problems with further development of your software.
Logged
P7a/P11c/f/g P24a/b/e/f/g PZL23/42 PWS-10/26 R-XIII RWD-10/14 GeeBeeR1/R2/Granville P-45 , WhippetMkI, Sdkfz-234/1/2, Kurogane, TKS, Wz.29/34 and some other shit XD

Stainless

  • Modder
  • member
  • Offline Offline
  • Posts: 1534
Re: msh Binary format
« Reply #66 on: April 12, 2014, 07:36:45 AM »

Well it's not going to be much use if it just crashes.

Maybe I should write a scan routine that walks through the HIM and meshes looking for problems and displays a report.

If the scan doesn't show anything nasty, you are safe to load the mesh.

Logged

hello

  • member
  • Offline Offline
  • Posts: 287
  • aka Aufpassen! aka Alfie!
Re: msh Binary format
« Reply #67 on: April 15, 2014, 12:54:37 AM »

Well it's not going to be much use if it just crashes.

Maybe I should write a scan routine that walks through the HIM and meshes looking for problems and displays a report.

If the scan doesn't show anything nasty, you are safe to load the mesh.

A scan routine sounds like a good idea, should makae your program more robust too.
Making any progress atm? Or is RL dragging your talents away from IL2?

All the best,
Mark
Logged

Stainless

  • Modder
  • member
  • Offline Offline
  • Posts: 1534
Re: msh Binary format
« Reply #68 on: April 15, 2014, 02:31:00 AM »

At the moment I'm fighting with the IMF textures, I have almost decoded the format... but obviously almost isn't good enough.

The file has a seven byte header, then 1 byte defining 24 or 32 bits.

Then width and height as shorts.

After that it has a table of bytes mode[height], which are 1-4 These are mode flags for each line of the graphic

Mode 1 is an accumulated value, i.e. the pixels are stored as a delta from the pixel one to the left of the current pixel
Mode 2 appears to be an accumulated value from the pixel above the current one

But I haven't worked out mode 3 and 4 yet


Logged

SAS~Loku

  • SAS Team
  • member
  • Offline Offline
  • Posts: 662
Re: msh Binary format
« Reply #69 on: April 15, 2014, 03:32:44 AM »

There is IMF converter tool by Kumpel https://www.sas1946.com/main/index.php?topic=1110.0
On readme there is info: "tga>imf, the image data are saved filtered PNG style either as 24bit RGB alone or with added 8bit alpha channel" maybe it can help you.
Logged
P7a/P11c/f/g P24a/b/e/f/g PZL23/42 PWS-10/26 R-XIII RWD-10/14 GeeBeeR1/R2/Granville P-45 , WhippetMkI, Sdkfz-234/1/2, Kurogane, TKS, Wz.29/34 and some other shit XD

Stainless

  • Modder
  • member
  • Offline Offline
  • Posts: 1534
Re: msh Binary format
« Reply #70 on: April 15, 2014, 05:24:34 AM »

Yes I have got a copy, but I don't want modders to have to convert all the textures to tga just to run my tool. I really want my tool to be able to handle IMF files transparently.

It has helped me work out some of the details, but it's a weird file format.
Logged

Stainless

  • Modder
  • member
  • Offline Offline
  • Posts: 1534
Re: msh Binary format
« Reply #71 on: April 15, 2014, 06:03:47 AM »

Making good progress now

The format seems to be based on an early version of PNG

The four modes are the same as the four modes in png, just with a few minor differences I am trying to figure out why I have glitches.

Logged
Pages: 1 ... 3 4 5 [6] 7 8 9 ... 50   Go Up
 

Page created in 0.029 seconds with 25 queries.