Skip to content

Commit e76a81e

Browse files
3vcloudclaude
andcommitted
fix(dat): render DXTL textures opaque
DXTL's fourth channel is luminance, not transparency - it premultiplies the colour and the texture is opaque. ProcessImageFile kept that channel as alpha, so DXTL content (all skill icons) rendered at ~35-60% opacity: washed out and semi-transparent. Force alpha to 255 after premultiplying. Confirmed against real skill icons (0x154c4, 0x6155, both ATEXDXTL) which now decode to full opacity; visually verified via exported DDS. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 3217303 commit e76a81e

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

GWToolboxdll/Utils/GwDat/AtexReader.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,13 +341,16 @@ DatTexture ProcessImageFile(unsigned char* img, int size)
341341
tex_type = TextureType::BC5;
342342
break;
343343
case 'L':
344+
// DXTL's fourth channel is luminance, not transparency: premultiply the
345+
// colour by it and leave the texture opaque (skill icons etc. are DXTL).
344346
AtexDecompress((unsigned int*)img, size, 0x12, r, (unsigned int*)output.data());
345347
image = ProcessDXT5((unsigned char*)output.data(), r.xres, r.yres);
346348
for (int x = 0; x < r.xres * r.yres; x++)
347349
{
348350
image[x].r = (image[x].r * image[x].a) / 255;
349351
image[x].g = (image[x].g * image[x].a) / 255;
350352
image[x].b = (image[x].b * image[x].a) / 255;
353+
image[x].a = 255;
351354
}
352355
tex_type = TextureType::BC5;
353356
break;

0 commit comments

Comments
 (0)