Sun, Aug 26, 2018
—WMOs, also known as MapObjs, make use of vertex colors to light everything from group geometry to units and game objects. These vertex colors are baked by the tooling employed by Blizzard’s artists–likely some kind of export plugin for the 3D modeling software they use. Vertex colors provide an efficient way of approximating a large number of lights at runtime.
The vertex colors baked into WMO data files undergo a few different runtime manipulations before being fed to the vertex and pixel shaders.
These manipulations are explained below.
If SMOHeader->flags
is not flagged with 0x1
, the client triggers the
CMapObj::AttenTransVerts
function. This function is called from inside CMapObj::RenderGroup
,
and only runs once per WMO group.
CMapObj::AttenTransVerts
overwrites vertex alpha values based on the distance from the associated
vertex to the nearest portal. The function only modifies vertex colors for vertices contained in
trans
batches. Vertex colors for vertices in int
and ext
batches are left alone.
The logic described in this section matches the behavior of the Wrath of the Lich King client. Newer versions of the client contain different / additional logic.
If a WMO group is flagged with SMOGroup::CVERTS
(0x4
) and SMOHeader->flags
is not flagged
with 0x8
, the client triggers the CMapObjGroup::FixColorVertexAlpha
function shown below. This
function is called from inside CMapObjGroup::CreateOptionalDataPointers
, and only runs once per
WMO group.
CMapObjGroup::FixColorVertexAlpha
overwrites vertex color values in the following ways:
trans
batch type vertices:
2
int
and ext
batch type vertices:
(alpha * rgb) / 64
to existing vertex color2
255
255
Note that the WMO pixel shaders multiply the incoming color by 2
, offsetting the division by 2
that occurs in FixColorVertexAlpha
.
|
|