Skip to content

Fix WMO textures importing into Blender as black - #594

Open
Wobblucy wants to merge 1 commit into
Kruithne:mainfrom
Wobblucy:fix/wmo-shader20-alpha
Open

Fix WMO textures importing into Blender as black#594
Wobblucy wants to merge 1 commit into
Kruithne:mainfrom
Wobblucy:fix/wmo-shader20-alpha

Conversation

@Wobblucy

@Wobblucy Wobblucy commented Aug 2, 2026

Copy link
Copy Markdown

WMO surfaces import into Blender rendering solid black even though the exported textures are fine. On the dungeon this was found on, the texture covering a third of the model has a good colour channel and an all-zero alpha channel.

Cause

Opaque game textures often carry an unused alpha channel that sits at zero. Blender defaults loaded images to STRAIGHT alpha, which multiplies the colour by alpha when sampling — so a texture with good colour and zero alpha reaches the shader as black.

Rendering the affected texture as flat emission makes it plain:

alpha_mode sampled result
STRAIGHT (default) black, median 0/255
CHANNEL_PACKED the actual art, median 88/255

Several material builders in import_wowobj.py already set CHANNEL_PACKED on the images they load, but the paths that go through loadImage without it — including the WMO shader 20 builder — kept the default and rendered black.

Change

loadImage sets alpha_mode = 'CHANNEL_PACKED' on every image it loads. This uses the colour as-is and — unlike NONE — keeps the alpha channel readable for the paths that use it as a blend mask or height source. One shared load point, all builders covered.

Verification

  • Flat-emission A/B render of the zero-alpha texture: STRAIGHT → black, CHANNEL_PACKED → correct colour.
  • Fresh import of the affected dungeon WMO and a terrain tile through the patched addon: previously-black surfaces render with their actual art.

@Wobblucy Wobblucy changed the title Fix WMO shader 20 textures importing as black Fix WMO textures importing into Blender as black Aug 3, 2026
@Wobblucy
Wobblucy force-pushed the fix/wmo-shader20-alpha branch from fa329bf to 931c4b8 Compare August 3, 2026 00:21
Opaque game textures often ship with an alpha channel that is unused and
sits at zero. Blender defaults loaded images to straight alpha and
multiplies the colour by it when sampling, so those textures reach the
shader as solid black even though their colour data is fine.

Loading everything channel-packed uses the colour as-is and keeps the
alpha channel readable for the material paths that treat it as a blend
mask or a height source. Several material builders already set this mode
on the images they load; doing it once at the shared load point covers
the paths that did not, including the WMO shader 20 builder.

Found on a Midnight dungeon WMO where the texture covering a third of
the model carries an all-zero alpha channel. Rendering that texture as
flat emission samples black with straight alpha and the actual art with
channel-packed; a full re-import of the dungeon confirms the affected
surfaces now render with their textures.
@Wobblucy
Wobblucy force-pushed the fix/wmo-shader20-alpha branch from 931c4b8 to c8afce2 Compare August 3, 2026 00:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants