M2

From wowdev
Revision as of 21:04, 10 August 2014 by Schlumpf (talk | contribs) (→‎Effects: fix whitespace and tables)
Jump to navigation Jump to search

Effects

UV-Animations

  • This block contains definitions for texture animations, for example, flowing water or lava in some models. The keyframe values are used in the texture transform matrix.

nTexAnims records of 0x3C bytes starting at ofsTexAnims, followed by data referenced in these records.

Offset Type Description
0x00 ABlock (float[3]) Translation
0x14 ABlock (short[4]) Rotation
0x28 ABlock (float[3]) Scaling

The three subrecords specify uv-transforms. Translation seems to work, producing nice flowing lava and waterfalls.

UV-Animation lookup table

  • nTexAnimLookup items starting at ofsTexAnimLookup.
Offset Type Name Description
0x00 uint16 AnimatedTextureId Array indices (0 to n-1). -1 for a static texture.

Ribbon emitters

  • nRibbonEmitters records of 0xB0 bytes starting at ofsRibbonEmitters, followed by data referenced in these records.

The records have the following structure:

Offset Type Name Description
0x00 uint32 Unknown Always (as I have seen): -1.
0x04 uint32 BoneID A bone to attach to.
0x08 float Position[3] And a position, relative to that bone.
0x14 int32 nTextures Number of referenced textures.
0x18 int32 ofsTextures Offset to the referenced textures.
0x1C int32 nBlendRef Number of some referenced integers,which look like the blending for the texture
0x20 int32 ofsBlendRef Offset to the blending-integers.
0x24 ABlock Color A color in three floats.
0x38 ABlock Opacity And an alpha value in a short, where: 0 - transparent, 0x7FFF - opaque.
0x4C ABlock Above The height above.
0x60 ABlock Below The height below. Do not set these to the same!
0x74 float Resolution This defines how smooth the ribbon is. A low value may produce a lot of edges.
0x78 float Length The length aka Lifespan.
0x7C float Emissionangle use arcsin(val) to get the angle in degree
0x80 short Renderflags[2] Perhaps the same as in renderflags
0x84 ABlock UnknownABlock1 (short)
0x98 ABlock UnknownABlock2 (boolean)
0xAC int32 unknown This looks much like just some Padding to the fill up the 0x10 Bytes, always 0

Some models that contain ribbon emitters and are viewable in the game world are: Wisps in BFD, Al'ar the Phoenix in Tempest Keep and any other phoenix models and the energy trails in the COT (not the actual instance, but the entrance cave in Tanaris Desert). Other models with ribbon emitters are spells and effects.

Parameters from the MDL format that are probably in here somewhere: emission rate, rows, cols ...?

Particle emitters

This is partly wrong as hell!

  • nParticleEmitters records starting at ofsParticleEmitters, followed by data referenced in these records.
Offset Type Name Description
0x000 uint32 Unknown Always (as I have seen): -1.
0x004 uint32 Flags See Below
0x008 float Position[3] The position. Relative to the following bone.
0x014 uint16 Bone The bone its attached to.
0x016 uint16 Texture And the texture that is used.
0x018 uint32 lenModelFilename The lenght of the ModelFilename. Zeroterminated String!
0x01C uint32 ofsModelFilename And the matching offset. This is used for spawning Models. *.mdx
0x020 uint32 lenParticleFileName The lenght of the ParticleFilename. Zeroterminated String!
0x024 uint32 ofsParticleFileName And the matching offset again.This is used for spawning particles of a model. *.mdx!
0x028 uint8 BlendingType A blending type for the particle. See Below
0x029 uint8 EmitterType 1 - Plane (rectangle), 2 - Sphere, 3 - Spline? (can't be bothered to find one)
0x02A uint16 ParticleColorSomething This one is used for ParticleColor.dbc. See below.
0x02C uint8 ParticleType? Found below.
0x02D uint8 HeadorTail 0 - Head, 1 - Tail, 2 - Both
0x02E uint16 TextureTileRotation Rotation for the texture tile. (Values: -1,0,1)
0x030 uint16 TextureRows How many different frames are on that texture? People should learn what rows and cols are.
0x032 uint16 TextureCols Its different everywhere. I just took it random.
0x034 ABlock EmissionSpeed All of the following blocks should be floats.
0x048 ABlock SpeedVariation Variation in the flying-speed. (range: 0 to 1)
0x05C ABlock VerticalRange Drifting away vertically. (range: 0 to pi)
0x070 ABlock HorizontalRange They can do it horizontally too! (range: 0 to 2*pi)
0x084 ABlock Gravity Fall down, apple!
0x098 ABlock Lifespan Everyone has to die.
0x0AC uint32 unknownPadding I don't know what these two values should do..
0x0B0 ABlock EmissionRate Stread your particles, emitter.
0x0C4 uint32 unknownPadding2 It could have been an array without them..
0x0C8 ABlock EmissionAreaLength Well, you can do that in this area.
0x0DC ABlock EmissionAreaWidth
0x0F0 ABlock Gravity2 A second gravity? Its strong.
0x104 FBlock ParticleColor (short, vec3f) This one points to 3 floats defining red, green and blue.
0x114 FBlock ParticleOpacity? (short, short) Looks like opacity (short) --Igor; Most likely they all have 3 timestamps for {start, middle, end}.
0x124 FBlock ParticleSizes (short, vec2f) It carries two floats per key. (x and y scale)
0x134 int32 UnknownFields[2] No references. Padding?
0x13C FBlock Intensity Some kind of intensity values seen: 0,16,17,32(if set to different it will have high intensity) (short, short)
0x14C FBlock UnknownReferences1 (short, short)
0x15C float UnknownFloats1[3] They have something to do with the spread.
0x168 float Scale[3] Wheey, its the scale!
0x174 float Drag Air resistance, see below.
0x178 float UnknownFloats2[2] More unknown fields.
0x180 float Rotation As a single value? Most likely only one axis then..
0x184 float UnknownFloats3[2] More unknown fields.
0x18C float Rot1[3] Model Rotation 1
0x198 float Rot2[3] Model Rotation 2
0x1A4 float Trans[3] Model Translation
0x1B0 float UnknownFloats4[4] Unknown, unknown, unknown, unknown, unknown...
0x1C0 uint32 nUnknownReference
0x1C4 uint32 ofsUnknownReference Vec3D array
0x1C8 ABlock EnabledIn (boolean) Has been in the earlier documentations. Enabled Anim Block. Appears to be used sparely now, probably there's a flag that links particles to animation sets where they are enabled.

About Drag: For a non-zero values, instead of travelling linearly the particles seem to slow down sooner. I can't work out the exact function but for a value of, say, 10, the particles pretty much stay in place. Not the same effect as gravity, though. Speed is multiplied by exp( -drag * t ). This value is also present in M3 format.

About particle rotation: 0 for none, 1 to rotate the particle 360 degrees throughout its lifetime.

Rotation can be a float value greater or less one. Results look better if use it as a "phase shift": particle_rotate = randfloat(-sys->rotation * pi, sys->rotation * pi); --Igor

Particle Flags

Value Description
0x1
0x2
0x4
0x8
0x10 Do not Trail
0x20
0x40
0x80 Particles in Model Space
0x100
0x200
0x400 Pinned Particles, their quad enlarges from their creation position to where they expand.
0x800
0x1000 XYQuad Particles. They align to XY axis facing Z axis direction.
0x2000
0x4000
0x8000
0x10000
0x20000
0x40000

ParticleColorSomething

This one is used so you can assign a color to specific particles. They loop over all particles and compare +0x2A to 11, 12 and 13. If that matches, the colors from the dbc get applied.

Particle types

Value Description
0 "normal" particle
1 large quad from the particle's origin to its position (used in Moonwell water effects)
2 seems to be the same as 0 (found some in the Deeprun Tram blinky-lights-sign thing)

ParticleType is always 0 and, maybe, now (Flags & 0x40000) != 0 means "particles from origin to position". --Igor Checked and verified --BlinkHawk

Particle Blendings

Value Description
0 glDisable(GL_BLEND); glDisable(GL_ALPHA_TEST);
1 glBlendFunc(GL_SRC_COLOR, GL_ONE);
2 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
3 glDisable(GL_BLEND); glEnable(GL_ALPHA_TEST);
4 glBlendFunc(GL_SRC_ALPHA, GL_ONE);

from Modelviewer source

The Fake-AnimationBlock

  • Its pretty much like the real one but without the "header".
Offset Type Name Description
0x000 uint32 nTimestamps The number of timestamps.
0x004 uint32 ofsTimestamps And the offset to them. The timestamps are shorts! (?)
0x008 uint32 nKeys The same number again. This time its the number of Keys / Values.
0x00C uint32 ofsKeys And their offset.

But they're unable to change between different animations, so they directly point to the data.