• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

Is there any information on the data in the MAT3 Chunk?

Messages
3
Country
unitedstates
I could not find the chunk in the wiki or in the forums. If I missed it, I apologize.

Thank you,

Lee
 
It appears to be similar in relation to MATE as IND3 is in relation to INDE but the data formats for the materials do not equate to the same size structs as the Material defined in the wiki.

Not sure where to go next on this. I posted in Prepar3D's Profession Plus forum as well but no responses, yet.

Lee
 
Hi Lee. You likely won't get any answers from LM, the formats are not documented. The "numeric" versions are P3D exclusive when they make changes to the format, mostly for PBR support. The Wiki only really covers FSX and P3DV1, I need to update it.

From what I can tell the format for MAT3 is the same as MATE with the addition of a float for z_bias at the end of the struct. The IND3 index list is the same format as INDE however uses unsigned 32-bit indices instead of 16. There are a few other sections like this that differ as well.

Cheers, Sean
 
Hi Lee. You likely won't get any answers from LM, the formats are not documented. The "numeric" versions are P3D exclusive when they make changes to the format, mostly for PBR support. The Wiki only really covers FSX and P3DV1, I need to update it.

From what I can tell the format for MAT3 is the same as MATE with the addition of a float for z_bias at the end of the struct. The IND3 index list is the same format as INDE however uses unsigned 32-bit indices instead of 16. There are a few other sections like this that differ as well.

Cheers, Sean

Wow, ty sir! Very helpful. That was it. Thank you for doing the hard work for me!
If it will help anyone else who comes here looking for this answer here is the structure:

Again, much appreciated.

Lee


C#:
[StructLayout(LayoutKind.Sequential, Size = 124)]
public struct Material
{
    public int material_flags;                   //   0
    public int material_flags_2;                 //   4
    public int diffuseTextureId;                 //   8
    public int detail_texture_index;             //  12
    public int bumpmap_texture_index;            //  16
    public int specularTextureId;                //  20
    public int emissive_texture_index;           //  24
    public int reflection_texture_index;         //  28
    public int fresnel_texture_index;            //  32
    public float4 diffuse;                       //  36 - 52
    public float4 specular;                      //  52 - 18
    public float specular_power;                 //  68
    public float detail_map_scale;               //  72
    public float bump_map_scale;                 //  76
    public float reflection_scale;               //  80
    public float precipitation_offset;           //  84
    public float specular_map_power_scale;       //  88
    public float specular_bloom_floor;           //  92
    public float ambient_light_scale;            //  96
    public int source_blend;                     // 100
    public int destination_blend;                // 104
    public int alpha_test_function;              // 108
    public float alpha_test_threshold;           // 112
    public float final_alpha_multiply;           // 116
    public float biasZ;                          // 120

    public override string ToString() { return $"Material {{ diffuse[{diffuseTextureId}] {diffuse}, specular[{specularTextureId}] {specular} }}"; }
}

[StructLayout(LayoutKind.Explicit, Size = 16)]
public struct float4
{
    [FieldOffset(0)] public float x;
    [FieldOffset(4)] public float y;
    [FieldOffset(8)] public float z;
    [FieldOffset(12)] public float w;

    [FieldOffset(0)] public float r;
    [FieldOffset(4)] public float g;
    [FieldOffset(8)] public float b;
    [FieldOffset(12)] public float a;

    public override string ToString() { return $"({x}, {y}, {z}, {w})"; }
}
 
Back
Top