SC2Mapster / m3addon

Blender Addon to import and export m3 files
GNU General Public License v2.0
49 stars 18 forks source link

V30 MODL Section in Heroes of the Storm 2.48 #11

Closed yretenai closed 3 years ago

yretenai commented 5 years ago

Unknown section at offset 32 with tag=MODL version=30 repetitions=1 sectionLengthInBytes=880 guessedUnusedSectionBytes=12 guessedBytesPerEntry=868.0

Model: mods\heroes.stormmod\base.stormassets\Assets\Units\Heroes\Storm_Hero_Alexstrasza_Cowl\Storm_Hero_Alexstrasza_Cowl.m3 (PTR)

Adding <version number="30" size="856" /> to structures.xml which allows it to decode, prints out the following:

Expected that field unknown13 of MODL (V. 30) has always the value 0, but it was 345
Expected that field unknown16 of MODL (V. 30) has always the value 0, but it was 345
Expected that field unknown19 of MODL (V. 30) has always the value 0, but it was 345
yretenai commented 5 years ago

This MODL version breaks material importing with a new material type: 12.

This seems to reference the MADD section. The MADD section references layers by index rather than normal name (diffuse, specular, decal, etc.)

    <madd-element>
        <name>test 2</name>
        <unknown2>
            <unknown2-element>0x26296dd2</unknown2-element>
            <unknown2-element>0x403525b2</unknown2-element>
            <unknown2-element>0xd394bd51</unknown2-element>
            <unknown2-element>0x28828f0c</unknown2-element>
            <unknown2-element>0xb07c7ff9</unknown2-element>
            <unknown2-element>0xb89400f</unknown2-element>
            <unknown2-element>0x5bfd1a1a</unknown2-element>
            <unknown2-element>0xb8c1bd58</unknown2-element>
            <unknown2-element>0xf2550862</unknown2-element>
            <unknown2-element>0x8a6de1c2</unknown2-element>
            <unknown2-element>0xe41d0f2</unknown2-element>
            <unknown2-element>0xbae5abf3</unknown2-element>
            <unknown2-element>0x9b8bffd</unknown2-element>
        </unknown2>
        <unknown3 />
        <unknown4>[snipped]</unknown4>
        <unknown5 structureName="SCHR" structureVersion="0" >
            <unknown5-element>
                <path>Assets/Textures/storm_hero_alexstrasza_cowl_norm.dds</path>
            </unknown5-element>
            <unknown5-element>
                <path>Assets/Textures/storm_hero_alexstrasza_cowl_spec.dds</path>
            </unknown5-element>
            <unknown5-element>
                <path>Assets/Textures/storm_hero_alexstrasza_cowl_spec.dds</path>
            </unknown5-element>
            <unknown5-element>
                <path>Assets/Textures/storm_hero_alexstrasza_cowl_diff.dds</path>
            </unknown5-element>
            <unknown5-element>
                <path>Assets/Textures/storm_hero_alexstrasza_cowl_emis.dds</path>
            </unknown5-element>
            <unknown5-element>
                <path>Assets/Textures/storm_hero_alexstrasza_cowl_spec.dds</path>
            </unknown5-element>
            <unknown5-element>
                <path>Assets/Textures/storm_blurredcube_generic.dds</path>
            </unknown5-element>
        </unknown5>
        <unknown6>[snipped]</unknown6>
    </additional-element>

the new material "block" in MODL looks as follows:

            <field name="standardMaterials" type="Reference" refTo="MAT_" />
            <field name="displacementMaterials" type="Reference" refTo="DIS_" />
            <field name="compositeMaterials" type="Reference" refTo="CMP_" />
            <field name="terrainMaterials" type="Reference" refTo="TER_" />
            <field name="volumeMaterials" type="Reference" refTo="VOL_" />
            <!-- it grew in size between version from 2 to 3 which indicates a reference-->
            <field name="unknownMaybeRef0" type="Reference" />
            <field name="creepMaterials" type="Reference" refTo="CREP" />
            <field name="volumeNoiseMaterials" type="Reference" refTo="VON_" since-version="25" />
            <field name="splatTerrainBakeMaterials" type="Reference" refTo="STBM" since-version="26" />
            <field name="reflectionMaterial" type="Reference" refTo="REF_" since-version="28" />
            <field name="lensFlareMaterial" type="Reference" refTo="LFLR" since-version="29" />
            <field name="shaderMaterial" type="Reference" refTo="MADD" since-version="30" />
Talv commented 5 years ago

Interesting. After quick research, going by the name MADD (which appears to be a GPU instruction), this new format was introduced to optimize shading process and reduce the stalls.

I've been wondering whether SC2 will follow this new format, but it seems this instruction requires Shader Model 5, which is part of dx11. While SC2 is stuck on dx9. https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/mad

I'll look about adding support for it once this new format becomes more common. PRs are welcome at any time - even if it would be just addition of new structure, without integrating it with Blender.

yretenai commented 5 years ago

I don't think that specific instruction is what is being referenced here, the MADD structure replaces all materials-- including standard material and it's layers.