Thanks a lot that helps a lot.

haggi


Am 03.02.2022 um 21:44 schrieb Larry Gritz:
PNG files are by specification "unassociated alpha". The OIIO convention is to convert all input to associated alpha automatically upon being read.

Unassociated alpha (the color channels are not premultiplied by the alpha) is bad for a number of reasons, especially inside a renderer. Associated alpha (aka premultiplied colors) are more like how light and cameras work, so the computations in any renderer are making this assumption, unless they are bending over backwards to accommodate unassociated alpha textures. Another reason that associated is preferred is that a lot of useful images have no way to be represented as unassociated -- the common example is an image that's a "transparent glow" -- high color value, but low alpha value. You just can't represent that correctly an an associated alpha PNG.

Exr files are by specification associated alpha. TIFF can go either way -- there is a field in the header that's supposed to say which it is -- but it's almost always associated. So that's why you're not seeing the same behavior for tif or exr.

I think that you can keep the png data unassociated as you convert it to a texture by using oiiotool instead of maketx:

    oiiotool -iconfig oiio:UnassociatedAlpha 1 in.png -otex out.tx

But in the renderer itself, you're going to have to account for the fact that this particular texture file came from an unassociated alpha source image. The math you need to do if you're using the texture will need to be different, you'll need to multiply the colors by alpha in the shader.

-- lg


On Feb 2, 2022, at 5:56 AM, haggi <ha...@haggi.de> wrote:

Hi,

we use recently started to use PNG files for texturing for Unity games and want to use the same texturing for Arnold and Unity. for effective texturing we use alpha channels with PNG files and had to discover that the maketx creates an color channel premultiplied with the alpha. This results in darker textures for our Arnold renderings compared to the ones we see in Unity or Maya OpenGL viewport. This behaviour only occurs with PNG files, not with tif or exr.

So my question is: What is the reason that the color channel is premultiplied for tx files?

haggi
_______________________________________________
Oiio-dev mailing list
Oiio-dev@lists.openimageio.org
http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org


--
Larry Gritz
l...@larrygritz.com





_______________________________________________
Oiio-dev mailing list
Oiio-dev@lists.openimageio.org
http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org
_______________________________________________
Oiio-dev mailing list
Oiio-dev@lists.openimageio.org
http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org

Reply via email to