Fix WMO textures importing into Blender as black - #594
Open
Wobblucy wants to merge 1 commit into
Open
Conversation
Wobblucy
force-pushed
the
fix/wmo-shader20-alpha
branch
from
August 3, 2026 00:21
fa329bf to
931c4b8
Compare
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
force-pushed
the
fix/wmo-shader20-alpha
branch
from
August 3, 2026 00:23
931c4b8 to
c8afce2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
STRAIGHTalpha, 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:
STRAIGHT(default)CHANNEL_PACKEDSeveral material builders in
import_wowobj.pyalready setCHANNEL_PACKEDon the images they load, but the paths that go throughloadImagewithout it — including the WMO shader 20 builder — kept the default and rendered black.Change
loadImagesetsalpha_mode = 'CHANNEL_PACKED'on every image it loads. This uses the colour as-is and — unlikeNONE— 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
STRAIGHT→ black,CHANNEL_PACKED→ correct colour.