Aller au contenu

Photo

[QUESTION] .mao semantics ("punchthrough" in particular) - Also, tints on multi-object meshes (in DAII)


  • Veuillez vous connecter pour répondre
25 réponses à ce sujet

#1
mesmerizedish

mesmerizedish
  • Members
  • 7 776 messages
Hi!

Fairly basic (hopefully) question: is there anywhere that how the .mao semantics work is clearly and thoroughly documented? I mean, for the most part, it's pretty straightforward: "AlphaArmourSkinTint" works for most everything :P But do they have to be in a particular order? And then, there's this weird "Punchthrough" semantic I've been noticing: what on earth does it do? o.O

SECOND VERSE (not quite like the first).

Tints on multi-object meshes (specifically in DAII, though Origins information might help me): how do I do it? I've tried every combination of object names I can think of, and only one part ever takes a tint. It's driving me mad.

#2
tmp7704

tmp7704
  • Members
  • 11 156 messages
As far as i can tell the "AlphaArmourSkinTint" etc are simply names of individual shaders the game comes with. Each of these shaders have bit different set of functions and as such take different arguments. I don't think the arguments have to come in fixed order in the .mao file.

Punchthrough shader is --taking a wild guess from where i saw it used-- simplified version of the alpha-mapped shader, one which uses simple alpha channel test to either draw the texel or not, rather than blending/face sorting of the regular alpha shader.

The whole list of shaders is constructed on the runtime based on info from one of config files the game comes with. I can't check at the moment the file name, but i think it's in one of the PMs you got.

Modifié par tmp7704, 14 septembre 2011 - 03:42 .


#3
DarthParametric

DarthParametric
  • Members
  • 1 409 messages
The MAO semantics are defined in XML files found in materials.erf (in DA1 at least).

My understanding of the Punch semantic is that it is intended for props that require holes using alphas, as opposed to other sorts of transparency.

Tinting of multi-part meshes can be extremely problematic. It generally requires a strict mesh naming convention to work, and for certain types of model it seemingly won't work regardless. As an example, for chest/torso armour you want to use the epithets _ArmorM1, _ArmorM2, _ArmorM3, etc. for the individual mesh names. Use the vanilla models as a guide.

#4
mesmerizedish

mesmerizedish
  • Members
  • 7 776 messages
Thanks for the replies ^_^

I don't know if I'm just doing something wrong or what, but the .mat files for DAII are almost entirely incomprehensible. There are no line breaks, and there are many symbols instead of words.

As for the naming: does the .msh have to follow the naming convention, or is it only the MMH_NAME field in the .mmh's section for a given chunk?

There aren't any multi-object meshes in the game that use tints. I noticed it first on Merrill's robes: her gloves are a separate part (I have no idea why :/), so they don't tint with the rest of her robe. The objects are armorm1 and glovesm1.

There are other multi-part meshes in the game: templar armor, mage and warrior champion armor... but none of them regularly have any tint applied to them.

The only other thing I can think of is full-face helmets that include an object for the eyes: I haven't done any testing with that though. Can the helmet AND the eyes both tint? I don't know :/

#5
DarthParametric

DarthParametric
  • Members
  • 1 409 messages
To clarify, I was referring to a single model comprising multiple individual meshes. Armour is typically three separate models - chest/torso, gloves, boots - at least in DA1 anyway. I can't really speak for DA2. There should be no issues getting those to tint. Each individual model just needs a tint mask that is properly referenced in its MAO and the appropriate material set in its UTI.

For actual multi-mesh models, the naming convention I referred to is for the MMH name field. If you name each mesh in Max/GMax appropriately, Eshme's script will export it properly. I don't know what happens using other export processes. You could always edit the files manually afterwards with a GFF editor.

I'm not sure that the eyes in helmets tint. A model receiving multiple different tints is problematic in my experience (again, in DA1). The only one that reliably works is armour getting an armour tint and a skin tint.

#6
mesmerizedish

mesmerizedish
  • Members
  • 7 776 messages
And, to clarify... I'm talking about a single mesh comprising multiple objects, but I don't need to apply different tints to them.

For example: one of my mod's adds Merrill's scarf to her romance-specific armor as a new object (I've experimented with various names for the new object: glovesm1, clothesm1, armorm2, etc.), but only armorm1 seems to tint. There seems to be some hierarchy: if I swap them, and name the scarf "armorm1," then the scarf tints, but the rest of the armor doesn't.

It's VEXING.

I need to buddy up with some BioWare technical artists. Anyone got some names/addresses/socialsecuritynumbers?

#7
DarthParametric

DarthParametric
  • Members
  • 1 409 messages
That's a single model comprised of multiple meshes. We are both talking about the same thing, but there seems to be confusion as to nomenclature.

Concerning the mesh names, name your armour mesh xx_ArmorM1 and additional meshes xx_ArmorM2, xx_ArmorM3, etc. If that doesn't work you may need to just bite the bullet and make them a single mesh, adjusting the UV map and texture accordingly.

#8
Eshme

Eshme
  • Members
  • 756 messages

ishmaeltheforsaken wrote...

I need to buddy up with some BioWare technical artists. Anyone got some names/addresses/socialsecuritynumbers?


No chance for a year in the past and future :innocent:

If you name each mesh in Max/GMax appropriately, Eshme's script will export it properly.


I dont think so :blush: There are "issues"

#9
DarthParametric

DarthParametric
  • Members
  • 1 409 messages
I was speaking about DA1 models. I know it doesn't work for DA2.

#10
Eshme

Eshme
  • Members
  • 756 messages
I know, thats where issues are.

#11
mesmerizedish

mesmerizedish
  • Members
  • 7 776 messages
Oh noes, issues!

I'm using Lightwave and tmp's plugin for my DAII work. I've never modded Origins. I have no idea how I would edit its UV map. The only time I've even touched UV mapping was when I UV mapped a new model from scratch for Oblivion (in Blender) and I never got that working :/

Does anyone know if multi-object meshes tinted properly in Origins? I don't even know if Origins had many multi-chunk models, but I'll bet the templar armor is, right? What are its parts named? (I can answer these questions myself; I'm just musing aloud :P)

It's Friday, so I have some time to experiment more this afternoon.

#12
DarthParametric

DarthParametric
  • Members
  • 1 409 messages
Ah, I recall now hearing about some of the model changes in DA2. Sounds like it is very different from Origins. As I said before, in DA1 vanilla armour is generally 3 separate single mesh models (chest, boots, gloves) - not a single model with 3 meshes.

If DA2 is what you are interested in, you might have more luck in the DA2 modding forum.

#13
mesmerizedish

mesmerizedish
  • Members
  • 7 776 messages

DarthParametric wrote...

Ah, I recall now hearing about some of the model changes in DA2. Sounds like it is very different from Origins. As I said before, in DA1 vanilla armour is generally 3 separate single mesh models (chest, boots, gloves) - not a single model with 3 meshes.

If DA2 is what you are interested in, you might have more luck in the DA2 modding forum.


DAII's vanilla armor is separate single-mesh models as well... the Champion armors have multiple parts, but I'm not interested in tinting them. Like I said, I'm mainly interested in tinting the model I put together myself: one .mmh, one .msh, two .maos.

I won't have more luck in the DAII modding forum. I'm already among the most knowledgable patrons there :blush:

*runs back to her experiments*

#14
tmp7704

tmp7704
  • Members
  • 11 156 messages

ishmaeltheforsaken wrote...

I have no idea how I would edit its UV map.

Fortunately, Lightwave makes that pretty simple: switch a viewport of choice to UV map view, and select the uv map you wish to edit (through one of small buttons in right lower corner of the main program window, next to the button which allows to select weight maps etc. For imported models there will be typically just one uv map to select.

Once the map is selected and visible you can drag its "vertices" around, scale etc the same way you edit geometry of the mesh.

(technically these are coordinates associated with the vertices you're "dragging" etc, but who cares)

Modifié par tmp7704, 16 septembre 2011 - 05:25 .


#15
mesmerizedish

mesmerizedish
  • Members
  • 7 776 messages
@tmp: thanks! I'm still mucking around, but if I do decide to just give up, that will be very helpful.

I thought I should mention (in case anyone else happens to have been curious) that tmp's guess regarding the "Punchthrough" semantic appears to be correct, i.e. Alpha sans blending. Maybe I'll post some pics of the same model using each.

#16
mesmerizedish

mesmerizedish
  • Members
  • 7 776 messages
Okay, so...

Is there anything in the .msh that could be contributing to which MMH_NAME tints and which doesn't?

armorm1 tints. clothesm1 tints. They don't both tint at the same time (whichever I name armorm1 tints, but the one I name clothesm1 doesn't).

Now, I tried naming one glovesm1 and one bootsm1. Neither tinted in this case. But actual boots named bootsm1 tint, and actual gloves named glovesm1 tint. So something's odd somewhere.

Maybe I didn't do everything properly when exporting? I really have no idea how all this works. I'm again curious if it's documented anywhere (even for Origins modeling).

#17
DarthParametric

DarthParametric
  • Members
  • 1 409 messages
If this is a single armour model, is it actually necessary for the chest/boots/gloves to be separate meshes? Just merge them into a single mesh and reposition the UVs so they don't overlap. Use 1024x1024 or 2048x2048 for your new custom texture, depending on what res the base textures were.

#18
mesmerizedish

mesmerizedish
  • Members
  • 7 776 messages
I'm just trying to understand the system right now :P

I can think of a reason not to do that, though: compatibility. My Scarf for Merrill mod is, currently, entirely compatible with any mod that alters the base texture of her romance armor (though the colors may clash, since my texture is designed with the vanilla in mind). If I were to combine the objects into one and re-do the UV, that compatibility would be lost.




[EDIT] Oh, and what is LerpedTint?

Modifié par ishmaeltheforsaken, 16 septembre 2011 - 08:50 .


#19
ChewyGumball

ChewyGumball
  • Members
  • 282 messages
The system has baffled us for quite some time. Whatever it is, it is not simple or straightforward.

#20
mesmerizedish

mesmerizedish
  • Members
  • 7 776 messages
//

// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111

//

//

// Buffer Definitions: 

//

// cbuffer $Globals

// {

//

//   row_major float4x4 aur_mModelView; // Offset:    0 Size:    64 [unused]

//   row_major float4x4 aur_mModelViewInverse;// Offset:   64 Size:    64 [unused]

//   row_major float4x4 mml_mVSMViewProjectionTexMatrix;// Offset:  128 Size:    64 [unused]

//   float4 mml_vRimLightParams[2];     // Offset:  192 Size:    32

//   float4 g_vShadowData[4];           // Offset:  224 Size:    64

//   float aur_fFrameTime;              // Offset:  288 Size:     4 [unused]

//   float g_fApplicationTime;          // Offset:  292 Size:     4 [unused]

//   float g_fFocalPlane;               // Offset:  296 Size:     4 [unused]

//   float4 g_fFBViewportRatios;        // Offset:  304 Size:    16 [unused]

//   float4 eng_vWireframeColor;        // Offset:  320 Size:    16

//   bool g_bShaderControlBooleans[6];  // Offset:  336 Size:    84 [unused]

//   float4 g_bDebugControlBooleans[4]; // Offset:  432 Size:    64

//   float2 mml_vSpecularParams;        // Offset:  496 Size:     8

//   float4 DEBUG_TesselationData;      // Offset:  512 Size:    16 [unused]

//   float4 mml_vEmissiveMultiplier;    // Offset:  528 Size:    16 [unused]

//   float mml_fOpacityMultiplier;      // Offset:  544 Size:     4

//   float mml_fSpecularPower;          // Offset:  548 Size:     4

//      = 0x43800000 

//   float mml_fSpecularReflectionMult; // Offset:  552 Size:     4 [unused]

//   float4 mml_vTintMaskColours[10];   // Offset:  560 Size:   160

//   float4 mml_vUVScrollSpeed;         // Offset:  720 Size:    16 [unused]

//   float4 mml_vMaskUVScrollSpeed;     // Offset:  736 Size:    16 [unused]

//   float4 mml_vUVDetailScrollSpeed;   // Offset:  752 Size:    16 [unused]

//   float4 mml_vTintColor;             // Offset:  768 Size:    16

//   float mml_fGoreThreshold;          // Offset:  784 Size:     4

//   float4 mml_vGoreColor;             // Offset:  800 Size:    16

//   float aur_fContactSheetCoord;      // Offset:  816 Size:     4 [unused]

//   float4 mml_vReflectivity;          // Offset:  832 Size:    16

//   float4 mml_vFalloffParams;         // Offset:  848 Size:    16 [unused]

//   float mml_fdistortion_magnitude;   // Offset:  864 Size:     4 [unused]

//   float mml_fdistortion_invert;      // Offset:  868 Size:     4 [unused]

//   float mml_fdistortion_fade_distance;// Offset:  872 Size:     4 [unused]

//   float mml_fdistortion_fade_multiplier;// Offset:  876 Size:     4 [unused]

//   float mml_fDepthAlphaBias;         // Offset:  880 Size:     4 [unused]

//   float4 mml_vFresnelParams;         // Offset:  896 Size:    16 [unused]

//   float4 mml_vLavaTint;              // Offset:  912 Size:    16 [unused]

//   float mml_fLavaBrightness;         // Offset:  928 Size:     4 [unused]

//   float mml_fLavaContrast;           // Offset:  932 Size:     4 [unused]

//   float mml_fLavaNoiseContrast;      // Offset:  936 Size:     4 [unused]

//   float4 mml_vRMPSettings[2];        // Offset:  944 Size:    32

//   float4 mml_vLightmapOffsetAndScale;// Offset:  976 Size:    16 [unused]

//   float mml_fNormalIntensity;        // Offset:  992 Size:     4

//   float4 g_fNormalZMultiply;         // Offset: 1008 Size:    16 [unused]

//   float4 vProjectionMatrixRow3;      // Offset: 1024 Size:    16 [unused]

//   float4 g_fCameraPlanes;            // Offset: 1040 Size:    16 [unused]

//   float mml_fReliefAspect;           // Offset: 1056 Size:     4 [unused]

//   float3 vGradientBottom;            // Offset: 1060 Size:    12 [unused]

//   float4 vGradientTop_TiltW;         // Offset: 1072 Size:    16 [unused]

//   float4 vGradientMiddle_MidPointW;  // Offset: 1088 Size:    16 [unused]

//   float mml_fVSMEpsilon;             // Offset: 1104 Size:     4 [unused]

//   float4 mml_vSHEnvironment[7];      // Offset: 1120 Size:   112

//   float3 mml_vHSVLightingMultiplier; // Offset: 1232 Size:    12

//

// }

//

// cbuffer SH_PerFrameConstants

// {

//

//   row_major float4x4 aur_mView;      // Offset:    0 Size:    64 [unused]

//   row_major float4x4 aur_mProjMatrix;// Offset:   64 Size:    64 [unused]

//   row_major float4x4 aur_mViewProjection;// Offset:  128 Size:    64 [unused]

//   row_major float4x4 aur_mViewInverse;// Offset:  192 Size:    64 [unused]

//   float4 mml_vFogParams[2];          // Offset:  256 Size:    32

//   float4 g_vCameraPosition;          // Offset:  288 Size:    16

//

// }

//

// cbuffer SH_LightArray

// {

//

//   float4 g_vLightParams[13];         // Offset:    0 Size:   208

//

// }

//

//

// Resource Bindings:

//

// Name                                 Type  Format         Dim Slot Elements

// ------------------------------ ---------- ------- ----------- ---- --------

// smpDecal                          sampler      NA          NA    0        1

// smpTintMask                       sampler      NA          NA    1        1

// smpNormalMap                      sampler      NA          NA    2        1

// smpSpecularMask                   sampler      NA          NA    3        1

// smpShadowPartition1               sampler      NA          NA    7        1

// smpGore                           sampler      NA          NA    8        1

// smpCubemap0                       sampler      NA          NA   10        1

// smpRemoteMaterialDecal            sampler      NA          NA   11        1

// smpNormalMap                      texture  float4          2d    0        1

// smpSpecularMask                   texture  float4          2d    1        1

// smpShadowPartition1               texture  float4          2d    2        1

// smpCubemap0                       texture  float4        cube    3        1

// smpDecal                          texture  float4          2d    4        1

// smpTintMask                       texture  float4          2d    5        1

// smpGore                           texture  float4          2d    7        1

// smpRemoteMaterialDecal            texture  float4          2d    8        1

// mml_tDynamicLights                texture  float4          2d    9        1

// $Globals                          cbuffer      NA          NA    0        1

// SH_PerFrameConstants              cbuffer      NA          NA    1        1

// SH_LightArray                     cbuffer      NA          NA    2        1

//

//

//

// Input signature:

//

// Name                 Index   Mask Register SysValue Format   Used

// -------------------- ----- ------ -------- -------- ------ ------

// SV_Position              0   xyzw        0      POS  float       

// TEXCOORD                 0   xy          1     NONE  float   xy  

// TEXCOORD                 7     zw        1     NONE  float     zw

// TEXCOORD                 1   xyz         2     NONE  float   xyz 

// TEXCOORD                 2   xyzw        3     NONE  float   xyzw

// TEXCOORD                 3   xyz         4     NONE  float   xyz 

// TEXCOORD                 4   xyzw        5     NONE  float   xyzw

// TEXCOORD                 5   xyzw        6     NONE  float   xyz 

// TEXCOORD                 9   xyzw        7     NONE  float   xy w

//

//

// Output signature:

//

// Name                 Index   Mask Register SysValue Format   Used

// -------------------- ----- ------ -------- -------- ------ ------

// SV_Target                0   xyzw        0   TARGET  float   xyzw

//

ps_4_0

dcl_constantbuffer cb0[78], immediateIndexed

dcl_constantbuffer cb1[19], immediateIndexed

dcl_constantbuffer cb2[9], immediateIndexed

dcl_sampler s0, mode_default

dcl_sampler s1, mode_default

dcl_sampler s2, mode_default

dcl_sampler s3, mode_default

dcl_sampler s7, mode_default

dcl_sampler s8, mode_default

dcl_sampler s10, mode_default

dcl_sampler s11, mode_default

dcl_resource_texture2d (float,float,float,float) t0

dcl_resource_texture2d (float,float,float,float) t1

dcl_resource_texture2d (float,float,float,float) t2

dcl_resource_texturecube (float,float,float,float) t3

dcl_resource_texture2d (float,float,float,float) t4

dcl_resource_texture2d (float,float,float,float) t5

dcl_resource_texture2d (float,float,float,float) t7

dcl_resource_texture2d (float,float,float,float) t8

dcl_resource_texture2d (float,float,float,float) t9

dcl_input_ps linear v1.xy

dcl_input_ps linear v1.zw

dcl_input_ps linear v2.xyz

dcl_input_ps linear v3.xyzw

dcl_input_ps linear v4.xyz

dcl_input_ps linear v5.xyzw

dcl_input_ps linear v6.xyz

dcl_input_ps linear v7.xyw

dcl_output o0.xyzw

dcl_temps 11

lt r0.x, l(0.000000), cb0[27].x

if_nz r0.x

  mov o0.xyzw, cb0[20].xyzw

  ret 

endif 

lt r0.x, l(0.000000), cb0[28].w

if_nz r0.x

  log r0.x, v1.w

  mul r0.x, r0.x, l(0.454545)

  exp o0.xyz, r0.xxxx

  mov o0.w, l(1.000000)

  ret 

endif 

lt r0.x, l(0.000000), cb0[27].z

if_nz r0.x

  sample r0.xyzw, v1.xyxx, t0.xyzw, s2

  mad r0.xy, r0.wyww, l(2.000000, 2.000000, 0.000000, 0.000000), l(-1.000000, -1.000000, 0.000000, 0.000000)

  dp2 r0.z, r0.xyxx, r0.xyxx

  min r0.z, r0.z, l(1.000000)

  add r0.z, -r0.z, l(1.000000)

  sqrt r0.z, r0.z

else 

  mov r0.xyz, l(0,0,1.000000,0)

endif 

lt r1.xy, l(0.000000, 0.000000, 0.000000, 0.000000), cb0[28].xzxx

if_nz r1.x

  dp3 r0.w, v2.xyzx, v2.xyzx

  rsq r0.w, r0.w

  mul r1.xzw, r0.wwww, v2.xxyz

  mov r2.xyz, v6.xyzx

  mov r2.w, l(1.000000)

  dp4 r3.x, cb0[14].xyzw, r2.xyzw

  dp4 r3.y, cb0[15].xyzw, r2.xyzw

  dp4_sat r0.w, cb0[16].xyzw, r2.xyzw

  add r0.w, r0.w, l(-0.005000)

  add r2.xyzw, r3.xyxy, l(-0.000291, -0.000362, -0.000750, -0.000066)

  sample r4.xyzw, r2.xyxx, t2.xyzw, s7

  ge r2.x, r4.x, r0.w

  sample r4.xyzw, r2.zwzz, t2.xyzw, s7

  ge r2.y, r4.x, r0.w

  and r2.xy, r2.xyxx, l(0x3f800000, 0x3f800000, 0, 0)

  add r2.x, r2.y, r2.x

  add r4.xyzw, r3.xyxy, l(-0.000621, 0.000408, -0.000182, 0.000554)

  sample r5.xyzw, r4.xyxx, t2.xyzw, s7

  ge r2.y, r5.x, r0.w

  and r2.y, r2.y, l(0x3f800000)

  add r2.x, r2.y, r2.x

  sample r4.xyzw, r4.zwzz, t2.xyzw, s7

  ge r2.y, r4.x, r0.w

  and r2.y, r2.y, l(0x3f800000)

  add r2.x, r2.y, r2.x

  add r4.xyzw, r3.xyxy, l(0.000859, -0.000174, 0.000423, -0.000429)

  sample r5.xyzw, r4.xyxx, t2.xyzw, s7

  ge r2.y, r5.x, r0.w

  and r2.y, r2.y, l(0x3f800000)

  add r2.x, r2.y, r2.x

  sample r4.xyzw, r4.zwzz, t2.xyzw, s7

  ge r2.y, r4.x, r0.w

  and r2.y, r2.y, l(0x3f800000)

  add r2.x, r2.y, r2.x

  add r3.xyzw, r3.xyxy, l(0.000464, 0.000685, 0.000166, -0.000797)

  sample r4.xyzw, r3.xyxx, t2.xyzw, s7

  ge r2.y, r4.x, r0.w

  and r2.y, r2.y, l(0x3f800000)

  add r2.x, r2.y, r2.x

  sample r3.xyzw, r3.zwzz, t2.xyzw, s7

  ge r0.w, r3.x, r0.w

  and r0.w, r0.w, l(0x3f800000)

  add r0.w, r0.w, r2.x

  add r2.xyz, v6.xyzx, -cb1[18].xyzx

  dp3 r2.x, r2.xyzx, r2.xyzx

  sqrt r2.x, r2.x

  add r2.x, -r2.x, l(16.000000)

  mul_sat r2.x, r2.x, l(0.312500)

  mad r0.w, r0.w, l(0.125000), l(-1.000000)

  mad r0.w, r2.x, r0.w, l(1.000000)

  dp3 r1.x, r1.xzwx, -cb2[4].xyzx

  mul r0.w, r0.w, r1.x

  max r0.w, r0.w, l(0.217630)

  lt r1.x, l(0.000000), cb0[28].z

  min r1.z, r0.w, l(0.990000)

  frc r1.z, r1.z

  add r1.z, r1.z, l(1.000000)

  movc r0.w, r1.x, r1.z, r0.w

else 

  mov r0.w, l(1.000000)

endif 

if_nz r1.y

  frc r1.x, r0.w

  mul r1.xyz, r1.xxxx, l(1.000000, 0.500000, 0.000000, 0.000000)

  lt r2.xyz, l(3.999000, 2.999000, 1.999000, 0.000000), r0.wwww

  movc r3.xyz, r2.zzzz, r1.zzxz, r1.zxzz

  movc r2.yzw, r2.yyyy, r1.xxzz, r3.xxyz

  movc o0.xyz, r2.xxxx, r1.xyzx, r2.yzwy

  mov o0.w, l(1.000000)

  ret 

endif 

dp3 r1.x, v5.xyzx, v5.xyzx

rsq r1.x, r1.x

mul r1.yzw, r1.xxxx, v5.xxyz

div r0.z, r0.z, cb0[62].x

mul r2.xyz, r0.yyyy, v3.xyzx

mad r2.xyz, r0.xxxx, v4.xyzx, r2.xyzx

mad r0.xyz, r0.zzzz, v2.xyzx, r2.xyzx

dp3 r2.x, r0.xyzx, r0.xyzx

rsq r2.x, r2.x

mul r0.xyz, r0.xyzx, r2.xxxx

sample r2.xyzw, v1.xyxx, t1.xyzw, s3

log r2.xyz, r2.xyzx

mul r2.xyz, r2.xyzx, l(2.200000, 2.200000, 2.200000, 0.000000)

exp r2.xyz, r2.xyzx

lt r3.xy, l(0.000000, 0.000000, 0.000000, 0.000000), cb0[30].xyxx

mad r4.xyz, v5.xyzx, r1.xxxx, -cb2[2].xyzx

dp3 r1.x, r4.xyzx, r4.xyzx

rsq r1.x, r1.x

mul r4.xyz, r1.xxxx, r4.xyzx

dp3_sat r1.x, r0.xyzx, r4.xyzx

log r1.x, r1.x

mul r1.x, r1.x, cb0[34].y

exp r1.x, r1.x

add r4.xyz, v6.xyzx, -cb2[0].xyzx

dp3 r3.z, r4.xyzx, r4.xyzx

rsq r3.z, r3.z

mad r4.xyz, -r4.xyzx, r3.zzzz, r1.yzwy

dp3 r3.z, r4.xyzx, r4.xyzx

rsq r3.z, r3.z

mul r4.xyz, r3.zzzz, r4.xyzx

dp3_sat r3.z, r0.xyzx, r4.xyzx

log r3.z, r3.z

mul r3.z, r3.z, cb0[34].y

exp r3.z, r3.z

mul r4.xyz, r3.zzzz, cb2[1].xyzx

mad r4.xyz, r1.xxxx, cb2[3].xyzx, r4.xyzx

add r5.xyz, v6.xyzx, -cb2[5].xyzx

dp3 r1.x, r5.xyzx, r5.xyzx

rsq r1.x, r1.x

mad r5.xyz, -r5.xyzx, r1.xxxx, r1.yzwy

dp3 r1.x, r5.xyzx, r5.xyzx

rsq r1.x, r1.x

mul r5.xyz, r1.xxxx, r5.xyzx

dp3_sat r1.x, r0.xyzx, r5.xyzx

log r1.x, r1.x

mul r1.x, r1.x, cb0[34].y

exp r1.x, r1.x

mad r4.xyz, r1.xxxx, cb2[6].xyzx, r4.xyzx

mad r4.xyz, r1.xxxx, cb2[8].xyzx, r4.xyzx

dp3 r1.x, cb0[70].xyzx, l(0.084629, 0.166436, 0.031030, 0.000000)

mul r3.z, r0.w, r0.w

ge r5.xy, l(0.000000, 0.000000, 0.000000, 0.000000), cb0[29].wzww

if_nz r5.x

  mov r5.xzw, l(0,0,0,0)

else 

  dp3 r3.w, -r1.yzwy, r0.xyzx

  add r3.w, r3.w, r3.w

  mad r6.xyz, r0.xyzx, -r3.wwww, -r1.yzwy

  add r3.w, -cb0[52].w, l(1.000000)

  mul r3.w, r3.w, l(6.000000)

  sample_l r6.xyzw, r6.xyzx, t3.xyzw, s10, r3.w

  log r6.xyz, r6.xyzx

  mul r6.xyz, r6.xyzx, l(2.200000, 2.200000, 2.200000, 0.000000)

  exp r5.xzw, r6.xxyz

endif 

mul r5.xzw, r5.xxzw, cb0[52].xxyz

mul r5.xzw, r2.wwww, r5.xxzw

mul r5.xzw, r3.zzzz, r5.xxzw

div r2.w, l(1.000000, 1.000000, 1.000000, 1.000000), cb0[31].x

mul_sat r2.w, r2.w, v5.w

mad r3.z, r2.w, l(-2.000000), l(3.000000)

mul r2.w, r2.w, r2.w

mul r2.w, r2.w, r3.z

mul r4.xyz, r4.xyzx, cb0[31].yyyy

mul r4.xyz, r0.wwww, r4.xyzx

mul r3.z, r1.x, r1.x

mul r1.x, r1.x, r3.z

min r1.x, r1.x, l(1.000000)

mul r4.xyz, r1.xxxx, r4.xyzx

movc r4.xyz, r5.yyyy, l(0,0,0,0), r4.xyzx

sample r6.xyzw, v1.xyxx, t5.xyzw, s1

mul r7.xyzw, r6.xyzw, cb0[36].xyzw

mul r8.xyz, r7.yyyy, cb0[40].xyzx

mad r8.xyz, cb0[38].xyzx, r7.xxxx, r8.xyzx

mad r8.xyz, cb0[42].xyzx, r7.zzzz, r8.xyzx

mad r8.xyz, cb0[44].xyzx, r7.wwww, r8.xyzx

dp4 r1.x, l(1.000000, 1.000000, 1.000000, 1.000000), r7.xyzw

add r7.xyz, -r2.xyzx, r8.xyzx

mad r2.xyz, r1.xxxx, r7.xyzx, r2.xyzx

if_nz r3.y

  mul r3.yzw, r2.xxyz, r4.xxyz

  mul r3.yzw, r2.wwww, r3.yyzw

  log r3.yzw, r3.yyzw

  mul r3.yzw, r3.yyzw, l(0.000000, 0.454545, 0.454545, 0.454545)

  exp o0.xyz, r3.yzwy

  mov o0.w, l(1.000000)

  ret 

else 

  mul r7.x, r0.y, cb0[70].w

  mul r7.yz, r0.yyyy, cb0[71].xxyx

  mul r7.xyz, r7.xyzx, l(0.488603, 0.488603, 0.488603, 0.000000)

  mad r7.xyz, cb0[70].xyzx, l(0.282095, 0.282095, 0.282095, 0.000000), r7.xyzx

  mul r8.xy, r0.zzzz, cb0[71].zwzz

  mul r8.z, r0.z, cb0[72].x

  mad r7.xyz, r8.xyzx, l(0.488603, 0.488603, 0.488603, 0.000000), r7.xyzx

  mul r8.xyz, r0.xxxx, cb0[72].yzwy

  mad r7.xyz, r8.xyzx, l(0.488603, 0.488603, 0.488603, 0.000000), r7.xyzx

  mul r8.xyz, r0.yyyy, cb0[73].xyzx

  mul r8.xyz, r0.xxxx, r8.xyzx

  mad r7.xyz, r8.xyzx, l(1.092548, 1.092548, 1.092548, 0.000000), r7.xyzx

  mul r8.x, r0.y, cb0[73].w

  mul r8.yz, r0.yyyy, cb0[74].xxyx

  mul r8.xyz, r0.zzzz, r8.xyzx

  mad r7.xyz, r8.xyzx, l(1.092548, 1.092548, 1.092548, 0.000000), r7.xyzx

  mul r8.xy, cb0[74].zwzz, l(0.315392, 0.315392, 0.000000, 0.000000)

  mul r8.z, cb0[75].x, l(0.315392)

  mul r9.xy, r0.zyzz, r0.zyzz

  mad r1.x, r9.x, l(3.000000), l(-1.000000)

  mad r7.xyz, r8.xyzx, r1.xxxx, r7.xyzx

  mul r8.xyz, r0.zzzz, cb0[75].yzwy

  mul r8.xyz, r0.xxxx, r8.xyzx

  mad r7.xyz, r8.xyzx, l(1.092548, 1.092548, 1.092548, 0.000000), r7.xyzx

  mul r8.xyz, cb0[76].xyzx, l(0.546274, 0.546274, 0.546274, 0.000000)

  mad r1.x, r0.x, r0.x, -r9.y

  mad r7.xyz, r8.xyzx, r1.xxxx, r7.xyzx

  max r7.xyz, r7.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)

  mul r1.x, cb0[77].y, cb0[77].z

  sincos r8.x, r9.x, cb0[77].x

  mul r4.w, r1.x, r9.x

  mul r1.x, r1.x, r8.x

  mul r8.xyzw, r4.wwww, l(0.701000, 0.587000, 0.114000, 0.299000)

  mad r5.y, cb0[77].z, l(0.299000), r8.x

  mad r5.y, r1.x, l(0.168000), r5.y

  mad r8.xyz, cb0[77].zzzz, l(0.587000, 0.114000, 0.299000, 0.000000), -r8.yzwy

  mad r7.w, r1.x, l(0.330000), r8.x

  mul r7.w, r7.y, r7.w

  mad r5.y, r5.y, r7.x, r7.w

  mad r8.xz, -r1.xxxx, l(0.497000, 0.000000, 0.328000, 0.000000), r8.yyzy

  mul r7.w, r7.x, r8.z

  mad r9.x, r8.x, r7.z, r5.y

  mul r10.xyzw, r4.wwww, l(0.413000, 0.300000, 0.588000, 0.886000)

  mad r8.xz, cb0[77].zzzz, l(0.587000, 0.000000, 0.114000, 0.000000), r10.xxwx

  mad r4.w, r1.x, l(0.035000), r8.x

  mad r4.w, r4.w, r7.y, r7.w

  mad r5.y, r1.x, l(0.292000), r8.y

  mad r9.y, r5.y, r7.z, r4.w

  mad r8.xy, cb0[77].zzzz, l(0.299000, 0.587000, 0.000000, 0.000000), -r10.yzyy

  mad r4.w, r1.x, l(1.250000), r8.x

  mad r5.y, -r1.x, l(1.050000), r8.y

  mul r5.y, r7.y, r5.y

  mad r4.w, r4.w, r7.x, r5.y

  mad r1.x, -r1.x, l(0.203000), r8.z

  mad r9.z, r1.x, r7.z, r4.w

  dp3 r1.x, cb0[13].xyzx, r0.xyzx

  add r1.x, -r1.x, l(1.000000)

  log r1.x, r1.x

  mul r1.x, r1.x, cb0[13].w

  exp r1.x, r1.x

  mad r7.xyz, cb0[12].xyzx, r1.xxxx, r9.xyzx

  movc r7.xyz, r3.xxxx, r7.xyzx, r9.xyzx

  sample r8.xyzw, v1.xyxx, t4.xyzw, s0

  log r8.xyz, r8.xyzx

  mul r8.xyz, r8.xyzx, l(2.200000, 2.200000, 2.200000, 0.000000)

  exp r8.xyz, r8.xyzx

  ge r9.xy, l(0.000000, 0.000000, 0.000000, 0.000000), cb0[27].ywyy

  movc r8.xyz, r9.xxxx, l(0.500000,0.500000,0.500000,0), r8.xyzx

  mul r7.xyz, r0.wwww, r7.xyzx

  movc r7.xyz, r9.yyyy, l(1.000000,1.000000,1.000000,0), r7.xyzx

  div r9.xy, v7.xyxx, v7.wwww

  add r9.xy, r9.xyxx, l(1.000000, 1.000000, 0.000000, 0.000000)

  mul r9.x, r9.x, l(0.500000)

  mad r9.z, -r9.y, l(0.500000), l(1.000000)

  sample_l(0,0,0) r9.xyzw, r9.xzxx, t9.xyzw, s0, l(0.000000)

  add r7.xyz, r7.xyzx, r9.xyzx

  mul r6.xyzw, r6.xyzw, cb0[35].xyzw

  mul r9.xyz, r6.yyyy, cb0[39].xyzx

  mad r9.xyz, cb0[37].xyzx, r6.xxxx, r9.xyzx

  mad r9.xyz, cb0[41].xyzx, r6.zzzz, r9.xyzx

  mad r9.xyz, cb0[43].xyzx, r6.wwww, r9.xyzx

  dp4 r0.w, l(1.000000, 1.000000, 1.000000, 1.000000), r6.xyzw

  add r6.xyz, -r8.xyzx, r9.xyzx

  mad r6.xyz, r0.wwww, r6.xyzx, r8.xyzx

  mul r6.xyz, r6.xyzx, r7.xyzx

  ne r0.w, l(0.000000, 0.000000, 0.000000, 0.000000), cb0[29].y

  min r7.xyz, r6.xyzx, l(0.790000, 0.790000, 0.790000, 0.000000)

  movc r6.xyz, r0.wwww, r7.xyzx, r6.xyzx

  mul r2.xyz, r2.xyzx, r4.xyzx

  mul r4.xyz, r2.wwww, r5.xzwx

  mad r2.xyz, r2.xyzx, r2.wwww, r4.xyzx

  add r3.yzw, r2.xxyz, r6.xxyz

endif 

lt r0.w, l(0.000000), cb0[30].z

if_nz r0.w

  mul r2.xyz, r2.wwww, r5.xzwx

  log r2.xyz, r2.xyzx

  mul r2.xyz, r2.xyzx, l(0.454545, 0.454545, 0.454545, 0.000000)

  exp o0.xyz, r2.xyzx

  mov o0.w, l(1.000000)

  ret 

endif 

add r2.xyz, v6.xyzx, -cb1[18].xyzx

dp3 r0.w, r2.xyzx, r2.xyzx

sqrt r0.w, r0.w

mov r2.x, v3.w

mov r2.y, l(0)

ge r2.xy, l(0.000000, 0.000000, 0.000000, 0.000000), r2.xyxx

and r2.zw, r2.xxxy, l(0, 0, 0x3f800000, 0x3f800000)

movc r2.xy, r2.xyxx, l(0,0,0,0), l(1.000000,1.000000,0,0)

add r4.xyz, -v1.xywx, l(1.000000, 1.000000, 1.000000, 0.000000)

mul r2.zw, r2.zzzw, r4.xxxy

mad r2.xy, r2.xyxx, v1.xyxx, r2.zwzz

add r2.xy, r2.xyxx, r2.xyxx

sample r2.xyzw, r2.xyxx, t7.xyzw, s8

mul r1.x, cb0[49].x, l(1.200000)

mad r1.x, r1.x, r4.z, -r2.x

mul_sat r1.x, r1.x, l(5.000000)

mad r2.x, r1.x, l(-2.000000), l(3.000000)

mul r1.x, r1.x, r1.x

mul r1.x, r1.x, r2.x

add r0.w, r0.w, l(-8.000000)

mul_sat r0.w, r0.w, l(0.500000)

mad r2.x, r0.w, l(-2.000000), l(3.000000)

mul r0.w, r0.w, r0.w

mad r0.w, -r2.x, r0.w, l(1.000000)

mul r0.w, r0.w, r1.x

mad r2.xyz, r2.yyyy, cb0[50].xyzx, l(-1.000000, -1.000000, -1.000000, 0.000000)

mad r2.xyz, r0.wwww, r2.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)

mul r2.xyz, r2.xyzx, r3.yzwy

sample r3.xyzw, v1.xyxx, t8.xyzw, s11

log r3.xyz, r3.xyzx

mul r3.xyz, r3.xyzx, l(2.200000, 2.200000, 2.200000, 0.000000)

exp r3.xyz, r3.xyzx

dp3 r0.x, r0.xyzx, r1.yzwy

add r0.y, -cb0[60].z, l(1.000000)

div r0.x, r0.x, cb0[60].y

add_sat r0.x, |r0.x|, -cb0[60].z

add r0.x, -r0.x, r0.y

mul r0.y, r3.w, cb0[60].x

mul r0.x, |r0.x|, r0.y

mul r0.x, r0.x, cb0[59].w

mad r0.yzw, cb0[59].xxyz, r3.xxyz, -r2.xxyz

mad r0.xyz, r0.xxxx, r0.yzwy, r2.xyzx

add r1.xyzw, -cb0[48].wxyz, l(1.000000, 1.000000, 1.000000, 1.000000)

div_sat r0.xyz, r0.xyzx, r1.yzwy

mul r1.yzw, r0.xxyz, r1.xxxx

lt r0.w, l(0.000000), cb0[28].y

mad r0.xyz, -r1.xxxx, r0.xyzx, cb1[16].xyzx

mad r0.xyz, v1.zzzz, r0.xyzx, r1.yzwy

movc r0.xyz, r0.wwww, r0.xyzx, r1.yzwy

log r0.xyz, r0.xyzx

mul r0.xyz, r0.xyzx, l(0.454545, 0.454545, 0.454545, 0.000000)

exp o0.xyz, r0.xyzx

mov o0.w, cb0[34].x

ret 

// Approximately 351 instruction slots used


#21
mesmerizedish

mesmerizedish
  • Members
  • 7 776 messages
So, the BSN doesn't have code tags? Lame.

Anyway, the above is the full text of character_character_p0.psh.fxo.dx11.assembly, the shader that handles tints. Anyone with a modicum of experience with assembly languages can feel free to try and read it, but it is entirely useless to someone as ignorant as I.

#22
ChewyGumball

ChewyGumball
  • Members
  • 282 messages
Its almost impossible to go from assembly to shader code since it generally is not a 1 to 1 conversion in the other direction. The most use you could get out of it is probably what textures it takes as inputs.

#23
mesmerizedish

mesmerizedish
  • Members
  • 7 776 messages
I have a friend who's offered to take a look at it *shrug*

Anyway, that's not what's interesting right now.

What's interesting is that Origins' .mat files are in plain .xml. Now, DAII's aren't. My best guess is that they're compiled GFFs like everything else BioWare use, but Mephales's editor doesn't recognize them as a readable file.

Is there anything I can do? I'm hopeful that I can find at least something of use in the material definitions, but if they're compiled... *flails*

Also interesting (to me at least): there are separate material files for DX11. And the DX11 ones are way bigger.

#24
ChewyGumball

ChewyGumball
  • Members
  • 282 messages
I am pretty sure the origins .mat files are just specifications for the shaders. There isn't any shader code in them. They are the best way to find out what an mao that uses the material needs in terms of maps, and for alternate versions of a material, but other than that there isn't anything else I could find in them that was useful. You might be able to manipulate some input values, but I'm not sure how the game uses the .mat files if at all.

As for reading DA2 mat files. They might be encypte/compressed which would make it harder to read. The first few bytes is normally a good indication of what type of file it is, bioware seems to like plain text headers, so perhaps opening one in notepad++ will give you more clues.

#25
mesmerizedish

mesmerizedish
  • Members
  • 7 776 messages
First line of character.mat.dx11 says "bmat" and then some not-plain-text characters that won't paste into the reply box: things like FF and NUL.