M2/Rendering: Difference between revisions
m (→Blending Modes) |
m (→Blending Modes) |
||
Line 132: | Line 132: | ||
Credits: Deamon, for unearthing blending mode names and laying out the table; relaxok, for checking D3D state at runtime; schlumpf, for all the initial reversing work; fallenoak, for mapping Deamon's table to OpenGL enums. | Credits: Deamon, for unearthing blending mode names and laying out the table; relaxok, for checking D3D state at runtime; schlumpf, for all the initial reversing work; fallenoak, for mapping Deamon's table to OpenGL enums. | ||
== Fog Modes == | |||
Because blending modes adjust how color is applied during a draw call, fog color often has to be modified accordingly. | Because blending modes adjust how color is applied during a draw call, fog color often has to be modified accordingly. | ||
Additionally, <tt>M2Material</tt> flag <tt>0x02</tt> causes fog mode <tt>0</tt> (disabled) to always be selected, regardless of blending mode. | |||
The following fog modes were taken from Mists of Pandaria (build 15662). | The following fog modes were taken from Mists of Pandaria (build 15662). | ||
Line 173: | Line 173: | ||
| ? liquid plane related ? | | ? liquid plane related ? | ||
| - | | - | ||
|} | |||
== Lighting Modes == | |||
Similar to fog modes above, blending modes also impact lighting. | |||
Additionally, <tt>M2Material</tt> flag <tt>0x01</tt> always causes lighting mode <tt>0</tt> (disabled) to be selected. | |||
{| class="wikitable sortable" | |||
|- | |||
! Lighting Mode | |||
! Action | |||
! Blending Modes | |||
|- | |||
| 0 | |||
| Disable lighting logic in shader | |||
| <tt>Blend_Mod</tt>, <tt>Blend_Mod2x</tt> | |||
|- | |||
| 1 | |||
| Enable lighting logic in shader | |||
| <tt>Blend_Opaque</tt>, <tt>Blend_AlphaKey</tt>, <tt>Blend_Alpha</tt>, <tt>Blend_Add</tt>, possibly: <tt>Blend_NoAlphaAdd</tt> | |||
|} | |} |
Revision as of 19:40, 27 November 2016
Blending Modes
Wrath of the Lich King and Cataclysm do not use separate alpha blending. Later expansion clients likely do use separate alpha blending.
Blend_BlendAdd was added after Cataclysm.
Values for functions match OpenGL, but each has a D3D equivalent.
State Idx | Mode | Blending Enabled | Src Color | Dest Color | Src Alpha | Dest Alpha |
---|---|---|---|---|---|---|
0 | Blend_Opaque | Disabled | ONE | ZERO | ONE | ZERO |
1 | Blend_AlphaKey | Disabled | ONE | ZERO | ONE | ZERO |
2 | Blend_Alpha | Enabled | SRC_ALPHA | ONE_MINUS_SRC_ALPHA | ONE | ONE_MINUS_SRC_ALPHA |
3 | Blend_Add | Enabled | SRC_ALPHA | ONE | ZERO | ONE |
4 | Blend_Mod | Enabled | DST_COLOR | ZERO | ? | ZERO |
5 | Blend_Mod2x | Enabled | DST_COLOR | SRC_COLOR | ? | SRC_ALPHA |
6 | Blend_ModAdd | Enabled | DST_COLOR | ONE | ? | ONE |
7 | Blend_InvSrcAlphaAdd | Enabled | ONE_MINUS_SRC_ALPHA | ONE | ONE_MINUS_SRC_ALPHA | ONE |
8 | Blend_InvSrcAlphaOpaque | Enabled | ONE_MINUS_SRC_ALPHA | ZERO | ONE_MINUS_SRC_ALPHA | ZERO |
9 | Blend_SrcAlphaOpaque | Enabled | SRC_ALPHA | ZERO | SRC_ALPHA | ZERO |
10 | Blend_NoAlphaAdd | Enabled | ONE | ONE | ZERO | ONE |
11 | Blend_ConstantAlpha | Enabled | CONSTANT_ALPHA | ONE_MINUS_CONSTANT_ALPHA | ? | ? |
12 | Blend_Screen | Enabled | ONE_MINUS_DST_COLOR | ONE | ONE | ZERO |
13 | Blend_BlendAdd | Enabled | ONE | ONE_MINUS_SRC_ALPHA | ONE | ONE_MINUS_SRC_ALPHA |
Credits: Deamon, for unearthing blending mode names and laying out the table; relaxok, for checking D3D state at runtime; schlumpf, for all the initial reversing work; fallenoak, for mapping Deamon's table to OpenGL enums.
Fog Modes
Because blending modes adjust how color is applied during a draw call, fog color often has to be modified accordingly.
Additionally, M2Material flag 0x02 causes fog mode 0 (disabled) to always be selected, regardless of blending mode.
The following fog modes were taken from Mists of Pandaria (build 15662).
Fog Mode | Action | Blending Modes |
---|---|---|
0 | Disable fog logic in shader | - |
1 | ? possibly: use fog color without changes ? | Blend_Opaque, Blend_AlphaKey, Blend_Alpha |
2 | Override fog color to 0x000000 (black) | Blend_Add, possibly: Blend_NoAlphaAdd |
3 | Override fog color to 0xFFFFFF (white) | Blend_Mod |
4 | Override fog color to 0x808080 (half white) | Blend_Mod2x |
5 | ? submerged camera related ? | - |
6 | ? liquid plane related ? | - |
Lighting Modes
Similar to fog modes above, blending modes also impact lighting.
Additionally, M2Material flag 0x01 always causes lighting mode 0 (disabled) to be selected.
Lighting Mode | Action | Blending Modes |
---|---|---|
0 | Disable lighting logic in shader | Blend_Mod, Blend_Mod2x |
1 | Enable lighting logic in shader | Blend_Opaque, Blend_AlphaKey, Blend_Alpha, Blend_Add, possibly: Blend_NoAlphaAdd |