Material

Materials define which shader along with what parameters the material uses.

Pattern

import type.base;

struct ResourceKey {
    type::Hex<u64> instance;
    type::Hex<u32> type;
    type::Hex<u32> group;
};

struct MaterialParameter {
    type::Hex<u32> type;
    u32 valueType;
    u32 valueFieldCount;
    u32 offset;
    
    u32 jump = $;
    $ = offset + 64;
    
    if(valueType == 1) {
        float color[valueFieldCount];
    } else if(valueType == 2) {
        u32 value;
    } else if(valueType == 4) {
        ResourceKey mapKey;
    }
    
    $ = jump;
};

struct MaterialData {
    u32 one1;
    u32 one2;
    padding[8]; // all zero
    u32 one3;
    ResourceKey self;
    u32 headerSize;
    u32 totalSize;
    char magic1[4];
    u32 version;
    type::Hex<u32> materialHash;
    type::Hex<u32> shaderHash;
    u32 mtrlSize;
    char magic2[4];
    padding[4]; // all zero
    u32 dataSize;
    u32 numParams;
    MaterialParameter params[numParams];
};

MaterialData material @ $;

Parameter names

namehash
diffuseColor0x7FEE2D1A
useLights0x76F88689
highlightMultiplier0x2616B09A
diffuseMap0x6CC0FD85
ambientMap0x20CB22B7
specularMap0xAD528A60
alphaMap0x2A20E51B
shadowReceiver0xF46B90AE
blendmode0xB2649C2F
transparency0x05D22FD3
ambient0x04A5DAA3
diffuse0x637DAA05
greenChannelMultiplier0xD1F4CB96
blueChannelMultiplier0x7BB10C17
redChannelMultiplier0x99BF82F6
nightTint0x689AEFFE
dayTint0xFBBBB5C2
overbrightDay0x1D17D10F
negativeColorBiasNight0xDB88EC28
negativeColorBiasDay0x29214C0C
overbrightNight0xB779F79B
specularColor0xBF2AD9B3
specular0x2CE11842
transparent0x988403F9
vNormalWaveSpeed0xAB26E148
emissionMap0xF303D152
vReflectionWaveSpeed0xDB319586
normalMapScale0x3C45E334
jitterScale0xA2E40EAB
waveFrequency0x02937388
uReflectionWaveSpeed0x50E0193B
waterColorBlue0x2A93BAFB
baseAlpha0x5916ED3E
reflectionSharpness0xE460597B
intensity0x933E38F4
waveAmplitude0x11EFE2FD
noiseFrequency0x7FD42F11
ShinyPower0xBD237B0D
VspeedLayer20x2E18B549
warpAmp0xDB5EBEE7
VspeedLayer00x2E18B54B
VspeedLayer10x2E18B54A
UspeedLayer10x7EEA0C2B
UspeedLayer00x7EEA0C2A
UspeedLayer20x7EEA0C28
reflectionIntensity0xD552A779
reflectionAmount0xB32A1342
uNormalWaveSpeed0x9F63578D
diffuseAlpha0xF72FCA9B
contrastSubtractColor0x7490C750
contrastMultiplyColor0x6612378C
amBodyShakespeare0x9038F94B
amHeadHairLongSpikey0x1067900C
auHeadHairBigFro0x0923FB40
afBodyLayeredSkirt0x58B2F06D
afHeadHairFortune0x80C83701
amHeadHairSpikey0x75486BDE
afHeadHairTightBun0x6C8C62C9
afHeadHatPirateGinny0x61F36B5B
auHeadHatCap0xE17E380C
faceSkinTones0x0FDC6FDC
auHeadHairFlowerCrown0x9EDA8CF5
amHeadHatBellhop0xF0D0E420
amHeadHatMagician0xC1519BCF
auHeadHatPilotGoggles0x8F0C0492
afBodyLowPoofSkirt0xC5AE022B
afBodyMayor0x383B9128
auHeadHatCapback0xD89AD4D5
afHeadHairLibrarian0x7255E7BE
afBodyTurtleneckBaggy0xE2498117
auHeadHatBeenie0xBCB6F07C
afHeadHairSmallBraids0xFCDF8C6A
afHeadHairPuffyLayers0x359839D2
amHeadHairIvyLeague0xDE545F5E
afHeadHairMayor0x146CB6B6
amHeadHairNigel0xE97A9352
auHeadHatNinja0xB4DE4520
auHeadHairMidShaggy0x7C22B02C
afBodyShortApron0x556E4212
afHeadHairCurlsRibbons0x8CBF470E
auBodyPantsJacketBag0x3B2679D5
afBodyShortSkirtSweater0xD12B0C98
amHeadHairRay0xCF76A1C7
amHeadHairArcade0xE029E90D
afBodyHighPoofLongSkirt0xF434AA77
afHeadHatBandanaDreads0xEA080C69
auHeadHairFoxEars0xC9314483
afBodyCollarSkirt0x7D6FDC4C
afBodyCoatSkirt0xC51BB766
afHeadHairStylishPeacock0xE806C452
afBodyKimono0x5F00B265
auHeadHatTopHat0x16E4CA30
amHeadHatChef0xB7A93AA8
auBodyKnight0x6515EB2C
amHeadHairEthan0xE9CA3E0B
afHeadHairClara0x0A371797
afHeadHatWendalyn0x6E2B178D
amBodyHauntedHouseBoy0xA822B3E8
auHeadHatMohawk0xD59381FB
auHeadHairSuperShortLayered0xE72A5F1C
amHeadHairTim0xEB85D831
auBodyHoodiePants0x79A3B7FF
afBodyLongSleeveLongDress0xD01B0A09
afHeadHatCowgirl0x4A351BDC
auHeadHatBald0x9ED158AB
amBodyMartialArts0xD9DFB575
propBookClosed0xE2B571A9
amBodyFlipper0xE1A22A57
afBodyLongSkirtLargeCuff0x66BA9C80
auHeadHatPirate0xE4F0D787
auHeadHairShortFlatBangs0x26F07855
auBodyBellhop0x2836EA65
auBodyApronBear0xC800D94B
afBodyKneeLengthSkirt0xDD91B6B6
auHeadHatRasta0x8D58D24F
afBodyLongSkirt0x32E0CA0B
auBodySkinTight0x23C6D774
auBodyCalfLengthPants0x7BEBDD19
plumbobColor0xEDDCECE1
afHeadHairDoubleBuns0x455BEF77
auHeadHairHairspraySpikey0xC36D202B
afHeadHairRaveKimono0xAFC8F11B
auHeadHairBowlCut0x40A202A7
amHeadHairCruise0xAD6D2254
auBodyLongPantsBoots0x57059004
afHeadHatNewspaperCap0x791597CA
afHeadHatBandana0x5519CFB6
afHeadHairAlexa0x811F207F
afHeadHairStreakedLolita0x37C3B76C
afHeadHairPuffyLayersBunny0xF8404FFA
auBodyApronTshirtPants0xBE323F01
auBodyLongPantsShortSleeves0xC34A68D0
amBodyArcade0xBCF4239B
afBodyAlexa0xB3F9D3F1
afBodyAsymmetricalSkirt0xCB6A2C62
auHeadHatCadet0x88B04723
auBodyBear0x8157DC19
auHeadHairDisco0x4E053DBD
afBodyShortSleeveApron0xAF284852
auBodyRolledSleevesLongPants0x8804B9B4
afHeadHairPigTail0x4487E3D4
afHeadHairLooseCurlsLong0xEBBB243F
afHeadHairLong0xBBF23C58
afHeadHairPigTailFlowers0xB9642FF0
afHeadHairLongBraid0xAA3CD006
afHeadHairLongPigtail0x804AD79A
afHeadHatBeaniePigtails0x608CAA94
afBodyChineseDress0xC3DD71DA
amHeadHatCowboy0xD987C7AD
afBodyFloristYoungerSister0x667D4E9C
auHeadHatEarhat0x1688F273
afHeadHairHighSalon0x4038B561
afHeadHairSoftBobBangs0xB857A450
afHeadHairKarine0x16229F12
amBodyGothCoat0xE808F034
afHeadHairBangsHighPonyTail0xEBB1363D
amHeadHatMartialArts0x10B11928
auHeadHairShortFro0x31B41A58
afBodyWendalyn0x32FF6934
amHeadHatShakespeare0x172754F2
auBodyBackpack0x4CF48F41
auHeadHairLongLayered0x5E5E0BB5
afHeadHairBee0xDB272B16
amHeadHairSlickBack0x0562A36E
afHeadHatFedoraHeadset0xADF12CDC
auBodySuitBowTie0x206508D6
amHeadHatNewspaperCap0x21EAEAC7
auBodyNoSleevesLongPants0x0568E523
amHeadHairPompadour0x4C34687C
auBodyPirate0x1F8C55E8
auBodyShortPantsShortSleeves0x6293CA92
amBodyChef0x57CFFD77
afBodyShortSkirtBag0x9E77273B
afHeadHairPuffyLayersTiara0x407405F3
amHeadHairSidePart0x61AB1E17
amBodySamurai0x69E3E1A7
amHeadHairShort0xF67D2839
amHeadHatFlipper0x68592352
afBodyFortuneTeller0x1437614B
auBodyShortSleevApronPants0xA8EC7CF0
auHeadHatVisor0x7FD2FD6D
auHeadHairMuseum0x94F2A3F5
amHeadHatBuzzCut0xAB532E19
auBodyShortJacketClosed0xEAE93C5D
afBodyHighPoofSkirt0x115E90E5
auHeadHatHippieBandana0xA66E30F0
afBodySmallWings0xE042258B
afHeadHairStylish0x6C25C854
afHeadHairLayeredBangsMedium0x30872F06
afHeadHatCrumplebottom0x6A7C3EFC
amHeadHatFedora0x0A0BF0F7
auHeadHairDandelion0x5C211319
auBodyNinja0x1514F851
auHeadHairSushi0x018261BD
afHeadHairLongLayered0x2A45864C
afHeadHairLongPonytail0x22DF72CE
auHeadHairVeryShortSpiky0x5A0C9575
afHeadHairObservatory0x8D6F69F2
auBodyBulkySweaterLongPants0x8637DF43
auHeadHairShortCurly0x5FC9D348
auBodyLongPantsLongSleeve0x86769DAF
amHeadHairScientist0x2344A259
auHeadHatBear0x79DBAB9E
amHeadHatCombOver0x1F0050D9
afBodyMini0x04985945
afHeadHairUpdoRibbons0x37A80FC1
amHeadHatBaker0x3D88B8B3
auBodyLabCoat0xBCC02D91
envmapAlpha0x0A345310
door_archedTopBar0x4A1A7937

Material Set

A material set is a list of references to material files.

Pattern

import type.base;

struct ResourceKey {
    type::Hex<u64> instance;
    type::Hex<u32> type;
    type::Hex<u32> group;
};

struct MTST {
    char magic[4];
    u32 version;
    u32 name;
    u32 index;
    u32 count;
    u32 indicies[count];
    padding[4];
};

struct MaterialSet {
    u32 one1;
    u32 one2;
    padding[4];
    u32 materialCount;
    u32 one3;
    ResourceKey selfKey;
    ResourceKey materials[materialCount];
    u32 headerSize;
    u32 mtstSize;
    MTST mtst;
};

MaterialSet materialSet @ $;