Special Aircraft Service

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 46 47 48 [49] 50   Go Down

Author Topic: msh Binary format  (Read 109516 times)

0 Members and 1 Guest are viewing this topic.

Dreamk

  • Modder
  • member
  • Offline Offline
  • Posts: 2017
Re: msh Binary format
« Reply #576 on: December 28, 2017, 12:43:18 AM »

BTW Importing from flightgear is not a problem - quite a number of converters (such as 3d converter 6.51 http://3doc.i3dconverter.com/) convert perfectly ac to 3ds that can be imported into 3dmax
Logged

Unca-Fester

  • Graduate of the Dirk Gently School of mucking about.
  • Modder
  • member
  • Offline Offline
  • Posts: 197
Re: msh Binary format
« Reply #577 on: December 28, 2017, 08:33:22 AM »

BTW Importing from flightgear is not a problem - quite a number of converters (such as 3d converter 6.51 http://3doc.i3dconverter.com/) convert perfectly ac to 3ds that can be imported into 3dmax

 I don't think that is what I was asking about.   I have Blender, which does an half-assed job of turning .ac's into .objs..

  I'm looking to avoid using either 3DMax or GMax as the export/import arbitritor between FG meshes and IL2 meshes.
Logged

Stainless

  • Modder
  • member
  • Offline Offline
  • Posts: 1534
Re: msh Binary format
« Reply #578 on: December 29, 2017, 02:59:41 AM »

Had a look at it.

You can "ALMOST" do it.

Looks like I have a problem somewhere.

You can load an ac file and it creates a structure correctly.





You can then save a him file which is correct

Code: [Select]
[_ROOT_]
VisibilitySphere 10
CollisionObject sphere 12 0 0 0
[_Cube.001_]
Mesh Mesh__Cube.001_
Parent _ROOT_
Attaching 1 0 0 0 -4.371139E-08 1 0 -1 -4.371139E-08 0 0 0
[_Cube_]
Mesh Mesh__Cube_
Parent _ROOT_
Attaching 1 0 0 0 -4.371139E-08 1 0 -1 -4.371139E-08 0 0 0

And then you can right click on each node in the HIM file and "dump as text" to create MSH files.

Code: [Select]
//Generated by Stainless

[Common]
NumBones 0
 FramesType Single
 NumFrames 1

[LOD]
150000

[Materials]
_DefaultWhite__clone

[FaceGroups]
84 28
0 0 84 0 28 0

[Vertices_Frame0]
27 7 -26 0 2808 0
-27 7 -26 0 2808 0
-27 7 26 0 2808 0
27 7 -26 0 2808 0
-27 7 26 0 2808 0
27 7 26 0 2808 0
27 -1 -26 416 0 0
27 7 -26 416 0 0
27 7 26 416 0 0
27 -1 -26 416 0 0
27 7 26 416 0 0
27 -1 26 416 0 0
27 -1 26 0 0 432
27 7 26 0 0 432
-27 7 26 0 0 432
27 -1 26 0 0 432
-27 7 26 0 0 432
-27 -1 26 0 0 432
-27 -1 26 -416 0 0
-27 7 26 -416 0 0
-27 7 -26 -416 0 0
-27 -1 26 -416 0 0
-27 7 -26 -416 0 0
-27 -1 -26 -416 0 0
27 7 -26 0 0 -432
27 -1 -26 0 0 -432
-27 -1 -26 0 0 -432
27 7 -26 0 0 -432
-27 -1 -26 0 0 -432
-27 7 -26 0 0 -432
21.80131 6.934766 15.5 903.0446 328.6813 -1.011145E-05
21.80131 6.934765 -15.5 903.0446 328.6813 -1.011145E-05
11.19869 36.06524 -15.5 903.0446 328.6813 -1.011145E-05
21.80131 6.934766 15.5 903.0446 328.6813 0
11.19869 36.06524 -15.5 903.0446 328.6813 0
11.19869 36.06524 15.5 903.0446 328.6813 0
5.897373 6.934766 -24.68214 -451.5224 328.6812 -782.0594
-20.94941 6.934765 -9.182138 -451.5224 328.6812 -782.0594
-15.6481 36.06524 2E-06 -451.5224 328.6812 -782.0594
5.897373 6.934766 -24.68214 -451.5223 328.6815 -782.0597
-15.6481 36.06524 2E-06 -451.5223 328.6815 -782.0597
11.19869 36.06524 -15.5 -451.5223 328.6815 -782.0597
-20.94941 6.934766 9.182147 -451.5221 328.6813 782.0596
5.897377 6.934765 24.68214 -451.5221 328.6813 782.0596
11.19869 36.06524 15.5 -451.5221 328.6813 782.0596
-20.94941 6.934766 9.182147 -451.5222 328.6814 782.0597
11.19869 36.06524 15.5 -451.5222 328.6814 782.0597
-15.6481 36.06524 2E-06 -451.5222 328.6814 782.0597
11.19869 36.06524 -15.5 0 832.2505 0
-15.6481 36.06524 2E-06 0 832.2505 0
11.19869 36.06524 15.5 0 832.2505 0
11.19869 36.06524 -15.5 0 832.2505 0
-15.6481 36.06524 2E-06 0 832.2505 0
11.19869 36.06524 15.5 0 832.2505 0
11.19869 36.06524 -15.5 0 832.2505 0
-15.6481 36.06524 2E-06 0 832.2505 0
11.19869 36.06524 15.5 0 832.2505 0
21.80131 6.934766 15.5 267.4801 97.35477 463.2891
11.19869 36.06524 15.5 267.4801 97.35477 463.2891
5.897377 6.934765 24.68214 267.4801 97.35477 463.2891
21.80131 6.934766 15.5 267.4801 97.35477 463.2891
11.19869 36.06524 15.5 267.4801 97.35477 463.2891
5.897377 6.934765 24.68214 267.4801 97.35477 463.2891
21.80131 6.934766 15.5 267.4801 97.35477 463.2891
11.19869 36.06524 15.5 267.4801 97.35477 463.2891
5.897377 6.934765 24.68214 267.4801 97.35477 463.2891
-20.94941 6.934765 -9.182138 -534.9603 97.35474 -5.055722E-06
-20.94941 6.934766 9.182147 -534.9603 97.35474 -5.055722E-06
-15.6481 36.06524 2E-06 -534.9603 97.35474 -5.055722E-06
-20.94941 6.934765 -9.182138 -534.9603 97.35474 -5.055722E-06
-20.94941 6.934766 9.182147 -534.9603 97.35474 -5.055722E-06
-15.6481 36.06524 2E-06 -534.9603 97.35474 -5.055722E-06
-20.94941 6.934765 -9.182138 -534.9603 97.35474 -5.055722E-06
-20.94941 6.934766 9.182147 -534.9603 97.35474 -5.055722E-06
-15.6481 36.06524 2E-06 -534.9603 97.35474 -5.055722E-06
11.19869 36.06524 -15.5 267.4801 97.35478 -463.2892
21.80131 6.934765 -15.5 267.4801 97.35478 -463.2892
5.897373 6.934766 -24.68214 267.4801 97.35478 -463.2892
11.19869 36.06524 -15.5 267.4801 97.35478 -463.2892
21.80131 6.934765 -15.5 267.4801 97.35478 -463.2892
5.897373 6.934766 -24.68214 267.4801 97.35478 -463.2892
11.19869 36.06524 -15.5 267.4801 97.35478 -463.2892
21.80131 6.934765 -15.5 267.4801 97.35478 -463.2892
5.897373 6.934766 -24.68214 267.4801 97.35478 -463.2892

[MaterialMapping]
0.96875 0.03125
0.96875 0.15625
0.03125 0.15625
0.96875 0.03125
0.03125 0.15625
0.03125 0.03125
0.96875 0.03125
0.96875 0.15625
0.03125 0.15625
0.96875 0.03125
0.03125 0.15625
0.03125 0.03125
0.96875 0.03125
0.96875 0.15625
0.03125 0.15625
0.96875 0.03125
0.03125 0.15625
0.03125 0.03125
0.96875 0.03125
0.96875 0.15625
0.03125 0.15625
0.96875 0.03125
0.03125 0.15625
0.03125 0.03125
0.96875 0.03125
0.96875 0.15625
0.03125 0.15625
0.96875 0.03125
0.03125 0.15625
0.03125 0.03125
0 0.203125
0.796875 0.203125
0.796875 1
0 0.203125
0.796875 1
0 1
0 0.203125
0.796875 0.203125
0.796875 1
0 0.203125
0.796875 1
0 1
0 0.203125
0.796875 0.203125
0.796875 1
0 0.203125
0.796875 1
0 1
0.296875 0.5
0.484375 0.5
0.484375 0.734375
0.296875 0.5
0.484375 0.5
0.484375 0.734375
0.296875 0.5
0.484375 0.5
0.484375 0.734375
0.78125 0.703125
0.96875 0.703125
0.96875 0.9375
0.78125 0.703125
0.96875 0.703125
0.96875 0.9375
0.78125 0.703125
0.96875 0.703125
0.96875 0.9375
0.78125 0.703125
0.96875 0.703125
0.96875 0.9375
0.78125 0.703125
0.96875 0.703125
0.96875 0.9375
0.78125 0.703125
0.96875 0.703125
0.96875 0.9375
0.78125 0.703125
0.96875 0.703125
0.96875 0.9375
0.78125 0.703125
0.96875 0.703125
0.96875 0.9375
0.78125 0.703125
0.96875 0.703125
0.96875 0.9375

[Faces]
0 1 2
3 4 5
6 7 8
9 10 11
12 13 14
15 16 17
18 19 20
21 22 23
24 25 26
27 28 29
30 31 32
33 34 35
36 37 38
39 40 41
42 43 44
45 46 47
48 49 50
51 52 53
54 55 56
57 58 59
60 61 62
63 64 65
66 67 68
69 70 71
72 73 74
75 76 77
78 79 80
81 82 83

However my code does not create the material files, so you can't just load in the new HIM and Bob's your fathers brother.

It wouldn't be hard to fix, if I had time, but at the moment I am snowed under. Not literally, no snow in sunny Southsea, but I have a game called Kingdom Come Deliverance I have to get out the door in two weeks. So no spare time at the moment.

You could create the MAT files by hand if you really need to in the mean time


Logged

Unca-Fester

  • Graduate of the Dirk Gently School of mucking about.
  • Modder
  • member
  • Offline Offline
  • Posts: 197
Re: msh Binary format
« Reply #579 on: December 29, 2017, 09:02:34 AM »

Had a look at it.
...

 No problem.  It's going to be a while before I get my IL2 WWI install in order, I appreciate what you done so far.  It's looking a lot more intuitive than using GMax's hellish mess of a GUI.   And the same problem occurs with my using .MQO or .ac imports to 3DS exports in Blender, the material alignment and file links get lost.

  Been there, and done that.

I wonder if in the interim that I could fudge something up using the .ac texture's scaling that occur's below the vertex section? 

Logged

Stainless

  • Modder
  • member
  • Offline Offline
  • Posts: 1534
Re: msh Binary format
« Reply #580 on: January 01, 2018, 05:46:43 AM »

The UV coordinates in the mesh are correct.

You just need to manually create the .MAT files.

Something like this for each texture

Code: [Select]
[ClassInfo]
  ClassName TMaterial
[General]
  tfDoubleSide 0
  tfShouldSort 0
  tfDropShadow 0
  tfGameTimer 1
[LightParams]
  Ambient 1.0
  Diffuse 1.0
  Specular 0.0
  SpecularPow 0
  Shine 0.0
[Layer0]
  TextureName ..\TEXTURES\gear.tga
  PaletteName
  Frame 0.0
  VisibleDistanceNear 0.0
  VisibleDistanceFar 10000.0
  TextureCoordScale 0.0 0.0 1.0 1.0
  ColorScale 1.0 1.0 1.0 1.0
  AlphaTestVal 0.5              // of [0.1, 0.5, 0.9]
  tfWrapX 1
  tfWrapY 1
  tfMinLinear 1
  tfMagLinear 1
  tfMipMap 0
  tfBlend 0
  tfBlendAdd 0
  tfTestA 0
  tfTestZ 1
  tfUpDateClear 0
  tfModulate 1
  tfNoTexture 0
  tfAnimatePalette 0
  tfAnimateSkippedFrames 0
  tfNoWriteZ 0
  tfDepthOffset 0
  tfTranspBorder 0
  tfTestZEqual 0


That should be enough
Logged

western0221

  • Modder
  • member
  • Offline Offline
  • Posts: 6790
  • Live in Japan
    • IL-2 itaki blog
Re: msh Binary format
« Reply #581 on: September 17, 2018, 01:31:25 AM »

Hi, Stainless.

Here is my post in MshConverter 1.18 topic.
Its main asking was about your modtool, so paste here.

Please consider.

I use your modtool in my modding / modeling.
And it's current release version is 1_0_0_54 , is OK ?

1_0_0_54 's functions seems not all ok.
I also use MshConverterEX to avoid 1_0_0_54 's trouble.

1. About all LODs, planned  UV value "< 0.0" or "> 1.0" (for loop texture rendering) are rounded between "0.0 < < 1.0" and loop is broken.
(Or modelers' bugs but not serious not seen in games .... very small values over 0.0 or 1.0 .... also broken.)

2. LOD0 is OK, but LOD1 or more 's UV - V plus/minus scale is inverted.
LOD1 / 2 / later models cannot be re-used.

3. better to generate Hook objects' rotating information.
Smoke / Fire / Weapon carry (and some more I don't know ones) Hooks use not only attaching position values but also rotating  values.
We have to re-rotate Hooks imported.

I hope your tool will become more perfect.
Thanks.
Logged

Stainless

  • Modder
  • member
  • Offline Offline
  • Posts: 1534
Re: msh Binary format
« Reply #582 on: September 17, 2018, 06:12:40 AM »

Are these issues with the FBX exporter?
Logged

western0221

  • Modder
  • member
  • Offline Offline
  • Posts: 6790
  • Live in Japan
    • IL-2 itaki blog
Re: msh Binary format
« Reply #583 on: September 17, 2018, 07:02:42 AM »

Are these issues with the FBX exporter?

Ah .... so .... Yes.

About FBX export function , and importing by 3ds Max.
Logged

Stainless

  • Modder
  • member
  • Offline Offline
  • Posts: 1534
Re: msh Binary format
« Reply #584 on: September 18, 2018, 12:36:03 AM »

Okay, that makes more sense.

I have noticed that some textures are inverted. This seems to be an issue with the TGA file format.

With the texture coordinates, I took advice from Mike and did some limiting, this may be causing problems in your use case.

What do you mean by "loop textures"?

I will look at the hooks, as far as I know I just export the whole matrix, but in FBX this is seperated into Translation and Rotation angles. Which means it is impossible to accurately export the rotation element. This is because a rotation matrix can be expressed as an infinite number of angular rotations. For example a matrix that represents a yaw of 90 can also be a yaw of -270, or +450 ad infinitum.



Logged

western0221

  • Modder
  • member
  • Offline Offline
  • Posts: 6790
  • Live in Japan
    • IL-2 itaki blog
Re: msh Binary format
« Reply #585 on: September 18, 2018, 02:12:54 AM »

Hi.

I have noticed that some textures are inverted. This seems to be an issue with the TGA file format.

With the texture coordinates, I took advice from Mike and did some limiting, this may be causing problems in your use case.

In my using your modtool 1_0_0_54 , LOD0's UV is perfect; Never inverted.

But LOD1/2/3.... 's UV are always inverted.

I think applying LOD1/2/3.... the same process of LOD0 .... solved.


What do you mean by "loop textures"?

In another word "tiling" ?


Fence object around Ship deck.


Its texture is only this.


UV mapping.



Cleat iron deck.


Its texture.


UV.



I will look at the hooks, as far as I know I just export the whole matrix, but in FBX this is seperated into Translation and Rotation angles. Which means it is impossible to accurately export the rotation element. This is because a rotation matrix can be expressed as an infinite number of angular rotations. For example a matrix that represents a yaw of 90 can also be a yaw of -270, or +450 ad infinitum.

That might not be trouble.

In 3ds Max's modeling stage, any rotate properties are rounded between -180 degree ~ +180 degree.
(I don't know an option setting to change the behavior exists or not exists.)
When I operate Object rotating +290 degrees around X axis in 3ds Max, its result rotate status becomes "The object is rotated -70 degrees".
They are same in static modeling stage and Hooks are also OK in this way.
[Hook] and [HookLoc] data in IL-2 .msh format are originally matrix, re-generating same matrix data in 3ds Max msh exporting time is only needed. -180 degree ~ +180 degree (or 0 degree ~ +360 degree) rotate property is enough for it.
Logged

Stainless

  • Modder
  • member
  • Offline Offline
  • Posts: 1534
Re: msh Binary format
« Reply #586 on: September 19, 2018, 12:29:51 AM »

I have looked at the code for exporting LOD's to fbx and it is the same for all LOD's

Code: [Select]
            #region Add UV coords
            // Create UV for Diffuse channel
            FbxLayerElementUV UVDiffuseLayer = FbxLayerElementUV.Create(mesh, "DiffuseUV");
            UVDiffuseLayer.Mapping_Mode = FbxLayerElement.MappingMode.ByPolygonVertex;
            UVDiffuseLayer.Reference_Mode = FbxLayerElement.ReferenceMode.IndexToDirect;
            for (int i = 0; i < Verts.Length; i++)
            {
                FbxVector2 fu = new FbxVector2(Verts[i].TextureCoordinate.X, Verts[i].TextureCoordinate.Y);
                UVDiffuseLayer.DirectArray.Add(fu);
            }
            layer.SetUVs(UVDiffuseLayer, FbxLayerElement.LayerElementType.DiffuseTextures);
            #endregion


You can see I don't play with the UV coordinates at all. I just save them. So if it works for one LOD, it should work for all.


On a normal mesh, i.e. not a LOD, I do play with the UV coordinates.


Code: [Select]

                #region Add UV coords
                // Create UV for Diffuse channel
                FbxLayerElementUV UVDiffuseLayer = FbxLayerElementUV.Create(mesh, "DiffuseUV");
                UVDiffuseLayer.Mapping_Mode = FbxLayerElement.MappingMode.ByPolygonVertex;
                UVDiffuseLayer.Reference_Mode = FbxLayerElement.ReferenceMode.IndexToDirect;
                for (int i = 0; i < Verts.Length; i++)
                {
                    FbxVector2 fu = getFBXUV(i);
                    //Debug.WriteLine(String.Format("{0}\t\t({1},{2})", i, Verts[i].TextureCoordinate.X, Verts[i].TextureCoordinate.Y));
                    UVDiffuseLayer.DirectArray.Add(fu);
                }
                layer.SetUVs(UVDiffuseLayer, FbxLayerElement.LayerElementType.DiffuseTextures);
                #endregion


        FbxVector2 getFBXUV(int i)
        {
            float x = Verts[i].TextureCoordinate.X;
            x -= (int)x;
            if (x < 0)
                x += 1;

            float y = Verts[i].TextureCoordinate.Y;
            y -= (int)y;
            if (y < 0)
                y += 1;
            y = 1 - y;

            return new FbxVector2(x, y);
        }

I did this after a long conversation with Mike I think. So long ago I am not sure why.

When it comes to hooks, I was correct. The problem is that FBX does not store matrices directly. A matrix is represented by translation, rotation, and scaling.


Code: [Select]

            #region Hooks
            foreach (Hook h in Hooks)
            {
                FbxNode hnode = FbxNode.Create(Form1.Instance.sdkManager, h.Name);
                hnode.Shading_Mode = FbxNode.ShadingMode.WireFrame;

                Quaternion qrot;
                Vector3 tran;
                Vector3 scl;
                h.matrix.Decompose(out scl, out qrot, out tran);

                Vector3 hlrot = FromQ2(rotation);

                hnode.Limits.ScalingLimitActive = false;
                hnode.Limits.RotationLimitActive = false;
                hnode.RotationActive = true;
                hnode.ScalingActive = true;


                hnode.SetRotationOrder(FbxNode.PivotSet.SourceSet, FbxRotationOrder.EulerZXY);


                Vector3 rtran = tran;
                hnode.LclTranslation.Set(new FbxDouble3(rtran.X, rtran.Y, rtran.Z));
                hnode.LclScaling.Set(new FbxDouble3(scl.X, scl.Y, scl.Z));
                hnode.LclRotation.Set(new FbxDouble3(hlrot.X, hlrot.Y, hlrot.Z));

                if (Form1.ExportHooks)
                    node.AddChild(hnode);
            }
            #endregion



Now there is lot's that can go wrong with that. It could just be the rotation order is incorrect I set it to FbxRotationOrder.EulerZXY which could easily be wrong.

I don't have any 3D editors that can load FBX so I am limited with what I can test. However I do have autodesk's FBX converter and everything I have looked at so far seems fine.


Logged

W0W66

  • member
  • Offline Offline
  • Posts: 236
Re: msh Binary format
« Reply #587 on: June 16, 2020, 12:41:25 PM »

Him File location help please?

I am using BAT, and trying to do a skin for the F-18.  I can find some HIM files, but multiple searchers for the F-18 HIM file give me nothing.

Not sure if I should ask here or over in the BAT section.

Thanks.
Logged
Pages: 1 ... 46 47 48 [49] 50   Go Up
 

Page created in 0.037 seconds with 26 queries.