Opened 12 years ago

Closed 9 years ago

Last modified 9 years ago

#1640 closed defect (fixed)

Texture conversion fails with grayscale PNGs

Reported by: historic_bruno Owned by: ben
Priority: Should Have Milestone: Alpha 19
Component: Core engine Keywords: codec
Cc: Patch:

Description

On some systems like mine, the conversion from 8-bit Grayscale PNG to 32-bit RGBA (tex_transform_to) silently fails, leading to a crash in NVTT's InputOptions::setMipmapData which expects 32-bit RGBA data. For now the workaround is to not add grayscale PNGs to the game's data :) The solution probably involves extending plain_transform to correctly handle grayscale data.

Change History (9)

comment:1 by historic_bruno, 12 years ago

Example of texture that causes the crash: art/textures/skins/gaia/decal_quarry_savanna_a_spec.png

comment:2 by ben, 12 years ago

In 12559:

Replaces grayscale decal texture with RGB, refs #1640

comment:3 by ben, 12 years ago

In 12560:

Displays error when converting a grayscale texture instead of possibly crashing, refs #1640

comment:4 by historic_bruno, 9 years ago

Re #3082, Deiz brought up a good point: the libpng API can be used to do some transformations. Here is an article describing a few: http://www.vias.org/pngguide/chapter13_08.html

We could use the GDK Pixbuf library (LGPL) as a reference: https://www.imagemagick.org/subversion/librsvg/trunk/gdk-pixbuf/gdk-pixbuf/io-png.c

comment:5 by ben, 9 years ago

In 16407:

Reverts action-heal cursor from r16386, it was modified to indexed color not currently supported by the engine, fixes #3082, refs #1640. Reapplies the transparent color removal, refs #2823.
Deletes unused test-old cursor

comment:6 by historic_bruno, 9 years ago

Going to use this ticket as a placeholder for the other PNG formats we could support. The changes required seem relatively simple, we just need time to test the changes (not days before a release).

comment:7 by historic_bruno, 9 years ago

Milestone: BacklogAlpha 19
Priority: Nice to HaveShould Have

comment:8 by ben, 9 years ago

Owner: set to ben
Resolution: fixed
Status: newclosed

In 16439:

Improves handling of PNG textures based on GdkPixbuf's setup_png_transformations. The PNG decoder should now support grayscale, RGB or indexed color; bit depth up to 16; and interlacing. Fixes #1640, refs #2823, #3082

comment:9 by ben, 9 years ago

In 16449:

Fixes grayscale PNG handling, there is no need to convert them all to RGB and r16439 broke special font texture handling. Instead, only grayscale with alpha PNGs will be converted to RGBA (they fail to load otherwise).
Removes warning about converting grayscale textures, refs #1640.

Note: See TracTickets for help on using tickets.