figglewatts / LSDView

Data file viewer for LSD Dream Emulator.
MIT License
27 stars 2 forks source link

Semi-transparency for TIM textures #5

Closed figglewatts closed 6 years ago

figglewatts commented 6 years ago

-- If Semi-Transparent mode is off -- Full-black without STP bit = Transparent (alpha = 0) Full-black with STP bit = Opaque black (alpha = 255) Non full-black without STP bit = Solid color (alpha = 255) Non full-black with STP bit = Solid color (alpha = 255)

-- If Semi-Transparent is on -- Full-black without STP bit = Transparent (alpha = 0) Full-black with STP bit = Semi-transparent black (alpha = 127) Non full-black without STP bit = Solid color (alpha = 255) Non full-black with STP bit = Semi-transparent color (alpha = 127)

figglewatts commented 6 years ago

Might have to use premultiplied alpha?

-Convert each 16-bit CLUT pixel to ARGB32, left-shifting each color component by 3 values if STP bit is set: -Use the highest color component as alpha value -Multiply each color component by (255.0 / highestColorComponent). Otherwise use 255 as alpha value.