Talk:M2: Difference between revisions

From wowdev
Jump to navigation Jump to search
No edit summary
No edit summary
Line 87: Line 87:


* Aha! Thanks very much :) I'll experiment with the modes more and see what I can find.
* Aha! Thanks very much :) I'll experiment with the modes more and see what I can find.
-- Auhem
-- Wain




== Particle Emitters ==
== Particle Emitters ==


Just trying to work out the changes in the Particle Emitter structure. The id (first value) is still always -1, in everything I tested. By eyeballing the values I think it's correct up to the point of blend mode and colour index (which is always 0, 11, 12 or 13). After that it gets weird. Particle Type, HeadOrTail, Texture Tile Rotation, etc. are showing unexpected values in some models, but not others.  
I'm not yet sure what to do with the new parameters: '''MultiTexParamX''' (array of 2 ints), and '''MultiTexParam1''' and '''MultiTexParam2''' (both arrays of two pairs of short ints). The values of these are supposed to be divided by floats to yield a smaller value. In almost all cases the scaled value results in a number between 0 and 1. However, occasionally in WoW Model Viewer I'm seeing extremely large numbers for MultiTexParam1 and MultiTexParam2. When this happens the values are always negative, as if it had gone into overflow. If I change the shorts to uint16 I still see very large values (just positive). If I try int8/uint8/int32/uint32 it breaks.


For example, this one doesn't look very unusual:
Below I've included raw (unscaled) values for a sample of models that use multitextured particles, along with some other parameters from the same particle emitter structure. The unusually large values are in bold. You'll note that some of the texture tile rotation values are also unusual, as they are expected to be -1, 0 or 1.


Creature\Moth\moth.m2
Maybe I'm doing something wrong with my data types?


Blend4 , Emitter Type:  1 , Color:  0 , Particle Type:  0 , HeadOrTail:  0 , Texture Tile Rotation:  0 , rows = 1 , cols = 1
{| style="background:#FCFCFC ; color:black; text-align:left"
! width="90" |Multitextured? !! width="60" |Blend Mode !! width="60" |Emitter Type !! width="60" |Texture<br/>Tile<br/>Rotat. !! width="140" |MultiTexParamX<br/>int [2] !! width="160" |MultiTexParam0<br/>{short x, short y} [2] !! width="160" |MultiTexParam1<br/>{short x, short y} [2]
|-
| colspan="7" | ''moosemount.m2''
|-
| true || 7 || 2 || 7 || 6 ; 3 || 12,12 ; '''-32761,-32761''' || 3,3 ; 3,3
|-
| true || 2 || 2 || 4 || 16 ; 22 || 0,76 ; 0,76 || 25,25 ; 12,12
|-
| true || 2 || 2 || 4 || 16 ; 22 || 0,76 ; 0,76 || 25,25 ; 12,12
|-
| true || 7 || 2 || 7 || 6 ; 3 || 12,12 ; '''-32761,-32761''' || 3,3 ; 3,3
|-
| true || 2 || 1 || 4 || 16 ; 22 || 0,51 ; 0,25 || 5,5 ; 2,2
|-
| true || 2 || 1 || 4 || 16 ; 22 || 0,51 ; 0,25 || 5,5 ; 2,2
|-
| true || 2 || 2 || 4 || 16 ; 22 || 0,76 ; 0,76 || 25,25 ; 12,12
|-
| true || 7 || 2 || 7 || 6 ; 3 || 12,12 ; '''-32761,-32761''' || 3,3 ; 3,3
|-
| true || 7 || 2 || 7 || 6 ; 3 || 12,12 ; '''-32761,-32761''' || 3,3 ; 3,3
|-
| true || 2 || 2 || 4 || 16 ; 22 || 0,76 ; 0,76 || 25,25 ; 12,12
|-
| colspan="7" | ''saber2mount.m2''
|-
| false || 4 || 1 || 0 || 0 ; 0 || 0,0 ; 0,0 || 0,0 ; 0,0
|-
| false || 4 || 1 || 0 || 0 ; 0 || 0,0 ; 0,0 || 0,0 ; 0,0
|-
| true || 4 || 1 || 0 || 25 ; 32 || 0,51 ; 0,0 || 0,0 ; 0,51
|-
| true || 4 || 1 || 0 || 25 ; 32 || 0,51 ; 0,0 || 0,0 ; 0,51
|-
| false || 4 || 1 || 0 || 0 ; 0 || 0,0 ; 0,0 || 0,0 ; 0,0
|-
| false || 4 || 1 || 0 || 0 ; 0 || 0,0 ; 0,0 || 0,0 ; 0,0
|-
| true || 4 || 1 || 0 || 12 ; 9 || 0,51 ; 0,0 || 0,0 ; 0,51
|-
| true || 4 || 1 || 0 || 25 ; 32 || 0,51 ; 0,0 || 0,0 ; 0,51
|-
| true || 4 || 1 || 10 || 12 ; 9 || 0,51 ; 0,0 || 0,0 ; 0,51
|-
| colspan="7" | ''ironhordeclefthoof.m2''
|-
| true || 7 || 1 || 1 || 8 ; 14 || 0,153 ; 0,102 || 30,30 ; 25,25
|-
| true || 7 || 1 || 1 || 8 ; 14 || 0,153 ; 0,102 || 30,30 ; 25,25
|-
| true || 7 || 1 || 1 || 8 ; 14 || 0,153 ; 0,102 || 30,30 ; 25,25
|-
| true || 7 || 1 || 1 || 8 ; 14 || 0,153 ; 0,102 || 30,30 ; 25,25
|-
| true || 7 || 1 || 1 || 8 ; 14 || 0,153 ; 0,102 || 30,30 ; 25,25
|-
| true || 7 || 1 || 1 || 8 ; 14 || 0,153 ; 0,102 || 30,30 ; 25,25
|-
| true || 7 || 1 || 1 || 8 ; 14 || 0,153 ; 0,102 || 30,30 ; 25,25
|-
| colspan="7" | ''ironhordeelekk.m2''
|-
| true || 7 || 1 || 1 || 8 ; 14 || 0,153 ; 0,102 || 30,30 ; 25,25
|-
| true || 7 || 1 || 1 || 8 ; 14 || 0,153 ; 0,102 || 30,30 ; 25,25
|-
| true || 7 || 1 || 1 || 8 ; 14 || 0,153 ; 0,102 || 30,30 ; 25,25
|-
| true || 7 || 1 || 1 || 8 ; 14 || 0,153 ; 0,102 || 30,30 ; 25,25
|-
| colspan="7" | ''ironhordewolf.m2''
|-
| true || 2 || 1 || 0 || 3 ; 6 || 15,15 ; '''-32753,15''' || 2,2 ; 2,2
|-
| true || 7 || 1 || 1 || 8 ; 14 || 0,153 ; 0,102 || 30,30 ; 25,25
|-
| true || 7 || 1 || 1 || 8 ; 14 || 0,153 ; 0,102 || 30,30 ; 25,25
|-
| true || 7 || 1 || 1 || 8 ; 14 || 0,153 ; 0,102 || 30,30 ; 25,25
|-
| colspan="7" | ''archimonde3.m2''
|-
| true || 7 || 1 || 5 || 16 ; 8 || 0,102 ; 0,102 || 0,76 ; 0,76
|-
| true || 7 || 1 || 5 || 16 ; 8 || 0,102 ; 0,102 || 0,76 ; 0,76
|-
| colspan="7" | ''voidcaller_v2.m2''
|-
| false || 4 || 1 || 1 || 0 ; 0 || 0,0 ; 0,0 || 0,0 ; 0,0
|-
| false || 4 || 1 || 1 || 0 ; 0 || 0,0 ; 0,0 || 0,0 ; 0,0
|-
| false || 4 || 1 || 0 || 0 ; 0 || 0,0 ; 0,0 || 0,0 ; 0,0
|-
| false || 4 || 1 || 0 || 0 ; 0 || 0,0 ; 0,0 || 0,0 ; 0,0
|-
| true || 2 || 2 || -3 || 32 ; 44 || '''0,-32666''' ; '''0,-32615''' || 51,12 ; 76,25
|-
| false || 2 || 1 || 0 || 0 ; 0 || 0,0 ; 0,0 || 0,0 ; 0,0
|-
| false || 2 || 1 || 0 || 0 ; 0 || 0,0 ; 0,0 || 0,0 ; 0,0
|-
| true || 2 || 2 || -1 || 16 ; 22 || 0,25 ; 0,38 || 12,12 ; 2,2
|-
| colspan="7" | ''voidlord_v2.m2''
|-
| false || 4 || 1 || 1 || 0 ; 0 || 0,0 ; 0,0 || 0,0 ; 0,0
|-
| false || 4 || 1 || 1 || 0 ; 0 || 0,0 ; 0,0 || 0,0 ; 0,0
|-
| false || 2 || 1 || -1 || 0 ; 0 || 0,0 ; 0,0 || 0,0 ; 0,0
|-
| true || 2 || 2 || -2 || 16 ; 22 || 0,25 ; 0,38 || 12,12 ; 2,2
|-
| true || 2 || 2 || -3 || 32 ; 44 || '''0,-32666''' ; '''0,-32615''' || 51,12 ; 76,25
|-
| colspan="7" | ''manafiend_void.m2''
|-
| false || 4 || 1 || 1 || 0 ; 0 || 0,0 ; 0,0 || 0,0 ; 0,0
|-
| false || 4 || 1 || 1 || 0 ; 0 || 0,0 ; 0,0 || 0,0 ; 0,0
|-
| false || 4 || 1 || -1 || 0 ; 0 || 0,0 ; 0,0 || 0,0 ; 0,0
|-
| false || 4 || 1 || -1 || 0 ; 0 || 0,0 ; 0,0 || 0,0 ; 0,0
|-
| true || 4 || 2 || 2 || 32 ; 16 || 0,0 ; 0,0 || 0,0 ; 0,0
|-
| true || 7 || 2 || 0 || 16 ; 6 || 0,0 ; 0,0 || 0,0 ; 0,0
|-
| true || 7 || 1 || 0 || 16 ; 6 || 0,0 ; 0,0 || 0,0 ; 0,0
|}


But these ones do:
--[[User:Wain|Wain]] ([[User talk:Wain|talk]]) 04:35, 31 October 2015 (UTC)
 
Creature\Moosemount\moosemount.m2
 
Blend:  7 , Emitter Type:  2 , Color:  0 , Particle Type:  6 , HeadOrTail:  3 , Texture Tile Rotation:  7 , rows =  1 , cols =  1
 
Blend:  2 , Emitter Type:  2 , Color:  0 , Particle Type:  16 , HeadOrTail:  22 , Texture Tile Rotation:  4 , rows =  2 , cols =  2
 
Creature\Corehound2\corehound2.m2
 
Blend:  4 , Emitter Type:  1 , Color:  0 , Particle Type:  0 , HeadOrTail:  0 , Texture Tile Rotation:  0 , rows =  2 , cols =  2
 
Blend:  7 , Emitter Type:  1 , Color:  0 , Particle Type:  8 , HeadOrTail:  14 , Texture Tile Rotation:  0 , rows =  2 , cols =  2
 
Blend:  4 , Emitter Type:  1 , Color:  0 , Particle Type:  8 , HeadOrTail:  16 , Texture Tile Rotation:  0 , rows =  1 , cols =  1
 
 
Very weird. Particle Type should be 0, 1 or 2, HeadOrTail should also be 0, 1 or 2. Texture Tile Rotation should be -1, 0 or 1.
 
After talking with schmoeckwitz I'm no closer to a solution, unfortunately. He's checked out the particle emitter and there's nothing either of us has found that would suggest those weird values. The structure in WoW Model Viewer is the expected size, and the only recent additions to it were at the end, apparently.
 
It seems possible at this point that those values (Particle Type, Head Or Tail, and Texture Tile Rot.) are no longer used for their original purposes and are now used for something entirely different.
--[[Special:Contributions/110.175.42.245|110.175.42.245]] 02:15, 28 October 2015 (UTC)

Revision as of 06:35, 31 October 2015

Finished for Build 8820 now. Post changes here first! And please pay attention to the style when you add something.. --schlumpf_ 00:53, 23 August 2008 (CEST)

Animation blocks in WotLK

  • Previously M2s used a single-timeline approach, chaining all animations into one long piece and separating them via begin and end given in animation data. Now, each animation has an own timeline.
  • Animation blocks contain a list of lists of timestamps and a list of lists of values, where the first list is by animation and the second one by timestamp-entry.
 template<typename T>
 struct array_ref
 {
   uint32_t number;
   T* elements;  // in file obviously an offset only
 };
 
 template<typename T>
 struct animation_block
 {
   uint16_t interpolation_type;
   uint16_t global_sequence;
   array_ref<array_ref<uint32_t>> timestamps;
   array_ref<array_ref<T>> values;
 };
  • Thus, as example, with
 struct bone
 {
   int32_t bone_id;
   uint32_t flags;
   int16_t parent_bone;
   uint16_t _1[3];
   animation_block<vec3_float> translation;
   animation_block<quat_short> rotation;
   animation_block<vec3_float> scale;
   vec3_float pivot;
 } b;

one may get the number of animations having translation information with

 b.translation.timestamps.number

and the number of timestamps in the first animation using

 b.translation.timestamps.elements[0].number

and the first timestamp value of the first animation via

 b.translation.timestamps.elements[0].elements[0]

The actual translation vector for animation 0 at timestamp 0 is at

 b.translation.values.elements[0].elements[0]
  • Some timestamps/values.elements entries may have number/elements = 0, if for that animation id no animation is given.
  • .anim files are just a blob of data which may as well be in the main model file, that is pointed to by the first array_ref layer.
  • [model file name][animation id]-[animation sub-id].anim
  • it seems like it is possible to detect if animation data is stored in-m2 or externally via
    • All animations which have flags & 0x20 are stored internally.
    • Animations which do not have flags & 0x20 are not stored internally.
    • Animations which do not have flags & 0x20 AND do not have flags & 0x40 are in .anim files
    • Animations which do not have flags & 0x20 AND DO have flags 0x40 are stored... somewhere. I have no clue.

Deleted Blocks

Block D

  • nD records of (int16, int16) starting at ofsD

Maybe a lookup table for animations? Since the numbers happen to be in fixed positions. The first short seems to increase with the position for models with all animations (like characters), the second seems to be flags or a modifier? Or something.


Contain indices into the texture animations list, or -1 meaning a static texture.


Render Flags

Please forgive any ignorance I show here as I'm not a professional programmer. I'm just trying to help improve Wow Model Viewer, which has very few staff left and these pages have been invaluable for understanding it :) I just wanted to mention something that confused me and I'm not sure if it needs correcting...

The Render Flags section of this page has two different tables for blend modes, with no mention of what the difference is. Is one out of date? The settings they recommend are different for a few modes, but they agree on others. I also tried them out in WMV and found that blend mode 1 is not working right with the settings from the tables (sections are appearing completely invisible when they shouldn't be) so maybe it's out of date in both, or there's something I'm not understanding. Perhaps it's meant to be used in conjunction with GL_ALPHA_TEST or glAlphaFunc() or something.

Thanks for all your work here! :)

- Auhem

  • the second table was created by relax by tracing directx stuff in the MoP client, the first one was later created by schlumpf based on reverse engineering the WoD beta client. The first table assumes alpha test to be the same, the second one lists them separate. there might be errors in both, tbh. feel free to fix them if you find them, or come to quakenet#modcraft to discuss them. :) --Schlumpf (talk) 16:47, 14 October 2015 (UTC)
  • Aha! Thanks very much :) I'll experiment with the modes more and see what I can find.

-- Wain


Particle Emitters

I'm not yet sure what to do with the new parameters: MultiTexParamX (array of 2 ints), and MultiTexParam1 and MultiTexParam2 (both arrays of two pairs of short ints). The values of these are supposed to be divided by floats to yield a smaller value. In almost all cases the scaled value results in a number between 0 and 1. However, occasionally in WoW Model Viewer I'm seeing extremely large numbers for MultiTexParam1 and MultiTexParam2. When this happens the values are always negative, as if it had gone into overflow. If I change the shorts to uint16 I still see very large values (just positive). If I try int8/uint8/int32/uint32 it breaks.

Below I've included raw (unscaled) values for a sample of models that use multitextured particles, along with some other parameters from the same particle emitter structure. The unusually large values are in bold. You'll note that some of the texture tile rotation values are also unusual, as they are expected to be -1, 0 or 1.

Maybe I'm doing something wrong with my data types?

Multitextured? Blend Mode Emitter Type Texture
Tile
Rotat.
MultiTexParamX
int [2]
MultiTexParam0
{short x, short y} [2]
MultiTexParam1
{short x, short y} [2]
moosemount.m2
true 7 2 7 6 ; 3 12,12 ; -32761,-32761 3,3 ; 3,3
true 2 2 4 16 ; 22 0,76 ; 0,76 25,25 ; 12,12
true 2 2 4 16 ; 22 0,76 ; 0,76 25,25 ; 12,12
true 7 2 7 6 ; 3 12,12 ; -32761,-32761 3,3 ; 3,3
true 2 1 4 16 ; 22 0,51 ; 0,25 5,5 ; 2,2
true 2 1 4 16 ; 22 0,51 ; 0,25 5,5 ; 2,2
true 2 2 4 16 ; 22 0,76 ; 0,76 25,25 ; 12,12
true 7 2 7 6 ; 3 12,12 ; -32761,-32761 3,3 ; 3,3
true 7 2 7 6 ; 3 12,12 ; -32761,-32761 3,3 ; 3,3
true 2 2 4 16 ; 22 0,76 ; 0,76 25,25 ; 12,12
saber2mount.m2
false 4 1 0 0 ; 0 0,0 ; 0,0 0,0 ; 0,0
false 4 1 0 0 ; 0 0,0 ; 0,0 0,0 ; 0,0
true 4 1 0 25 ; 32 0,51 ; 0,0 0,0 ; 0,51
true 4 1 0 25 ; 32 0,51 ; 0,0 0,0 ; 0,51
false 4 1 0 0 ; 0 0,0 ; 0,0 0,0 ; 0,0
false 4 1 0 0 ; 0 0,0 ; 0,0 0,0 ; 0,0
true 4 1 0 12 ; 9 0,51 ; 0,0 0,0 ; 0,51
true 4 1 0 25 ; 32 0,51 ; 0,0 0,0 ; 0,51
true 4 1 10 12 ; 9 0,51 ; 0,0 0,0 ; 0,51
ironhordeclefthoof.m2
true 7 1 1 8 ; 14 0,153 ; 0,102 30,30 ; 25,25
true 7 1 1 8 ; 14 0,153 ; 0,102 30,30 ; 25,25
true 7 1 1 8 ; 14 0,153 ; 0,102 30,30 ; 25,25
true 7 1 1 8 ; 14 0,153 ; 0,102 30,30 ; 25,25
true 7 1 1 8 ; 14 0,153 ; 0,102 30,30 ; 25,25
true 7 1 1 8 ; 14 0,153 ; 0,102 30,30 ; 25,25
true 7 1 1 8 ; 14 0,153 ; 0,102 30,30 ; 25,25
ironhordeelekk.m2
true 7 1 1 8 ; 14 0,153 ; 0,102 30,30 ; 25,25
true 7 1 1 8 ; 14 0,153 ; 0,102 30,30 ; 25,25
true 7 1 1 8 ; 14 0,153 ; 0,102 30,30 ; 25,25
true 7 1 1 8 ; 14 0,153 ; 0,102 30,30 ; 25,25
ironhordewolf.m2
true 2 1 0 3 ; 6 15,15 ; -32753,15 2,2 ; 2,2
true 7 1 1 8 ; 14 0,153 ; 0,102 30,30 ; 25,25
true 7 1 1 8 ; 14 0,153 ; 0,102 30,30 ; 25,25
true 7 1 1 8 ; 14 0,153 ; 0,102 30,30 ; 25,25
archimonde3.m2
true 7 1 5 16 ; 8 0,102 ; 0,102 0,76 ; 0,76
true 7 1 5 16 ; 8 0,102 ; 0,102 0,76 ; 0,76
voidcaller_v2.m2
false 4 1 1 0 ; 0 0,0 ; 0,0 0,0 ; 0,0
false 4 1 1 0 ; 0 0,0 ; 0,0 0,0 ; 0,0
false 4 1 0 0 ; 0 0,0 ; 0,0 0,0 ; 0,0
false 4 1 0 0 ; 0 0,0 ; 0,0 0,0 ; 0,0
true 2 2 -3 32 ; 44 0,-32666 ; 0,-32615 51,12 ; 76,25
false 2 1 0 0 ; 0 0,0 ; 0,0 0,0 ; 0,0
false 2 1 0 0 ; 0 0,0 ; 0,0 0,0 ; 0,0
true 2 2 -1 16 ; 22 0,25 ; 0,38 12,12 ; 2,2
voidlord_v2.m2
false 4 1 1 0 ; 0 0,0 ; 0,0 0,0 ; 0,0
false 4 1 1 0 ; 0 0,0 ; 0,0 0,0 ; 0,0
false 2 1 -1 0 ; 0 0,0 ; 0,0 0,0 ; 0,0
true 2 2 -2 16 ; 22 0,25 ; 0,38 12,12 ; 2,2
true 2 2 -3 32 ; 44 0,-32666 ; 0,-32615 51,12 ; 76,25
manafiend_void.m2
false 4 1 1 0 ; 0 0,0 ; 0,0 0,0 ; 0,0
false 4 1 1 0 ; 0 0,0 ; 0,0 0,0 ; 0,0
false 4 1 -1 0 ; 0 0,0 ; 0,0 0,0 ; 0,0
false 4 1 -1 0 ; 0 0,0 ; 0,0 0,0 ; 0,0
true 4 2 2 32 ; 16 0,0 ; 0,0 0,0 ; 0,0
true 7 2 0 16 ; 6 0,0 ; 0,0 0,0 ; 0,0
true 7 1 0 16 ; 6 0,0 ; 0,0 0,0 ; 0,0

--Wain (talk) 04:35, 31 October 2015 (UTC)