As I have my PBR rendering shader working, I find out another obscure in the Defold engine – all texture extract to memory with alpha premultiplied.
As PBR rendering require all data come to shader in linear space / original value, for diffuse data, it’s just a waste of precision, for texture contain other data like normal, metallic, gloss, AO etc, their alpha channel is NOT alpha AT ALL, premultiplying them make no sense.
What’s worse, since Defold does not support sRGB, I’ve to convert them from gamma space to linear space. with alpha premultiply and precision lost, dividing alpha from premultiplied RGB channel introduce loss of precision, and terrible artifact. This force me to use some ugly hack to overcome.
As describe above, please add option to choose if a texture shall have alpha premultiply or not.