Page MenuHome

Alpha channel of TGA, DDS, JPEG200, IRIS is not interpreted correctly
Closed, ResolvedPublic

Description

--- Operating System, Graphics card ---
Debian Wheezy AMD64

--- Blender version with error ---
tested 2.68a and current trunk

--- Short description of error ---
Loading an image file of type TGA, DDS, JPEG200, IRIS(sgi, rgba) or DPX whith an alpha channel
and rendering (Cycles was used) such alpha-masked textures, produces wrong results.
It might be that alpha is wrongly interpreted as premultiplied (I'm not sure).

On the other hand loading PNG (8 bit and 16 bit), EXR or TIFF (8 bit) produces correct results.
16 bit TIFF files have correct alpha, but the color channels are too bright.

Additionally JPEG2000 (12 bit and 16 bit) and DPX (10 bit, 12 bit, 16 bit) is too bright (color).

Note that saving an image in Blender produces correct results for all image types.
It is just the loading function that produces wrong results.

Please see files attached.

Thank you!

Robert


Details

Type
Bug

Event Timeline

Please attach .blend and image files to redo the problem, not just the resulting renders.

Here is a blend file with all necessary image formats. Just extract, open blend file and press F12 to render it.
You can use external software like ImageMagick to view the image files.

I just tested it with Blender Internal renderer and it produces correct results for color channels with all formats. But for DPX the alpha is detected as premultiplied. I don't know the specs of DPX, but Blender saves them with straight alpha, and loads it as premultiplied (although in BI it can be changed manually to Straight Alpha).

Thanks for the detailed test files. Cycles uses OpenImageIO so it can be a bit different than Blender. I've fixed the 16 bit tiff and submitted a fix for TGA to OpenImageIO.
https://github.com/OpenImageIO/oiio/pull/664

Jpeg2000 I have to check still, DPX I might put on a todo list since it may be quite complicated to solve, and it's not a common file format for image textures.

Thank you, Brecht!
DDS and IRIS (sgi, rgba) have the same problem as TGA. I didn't include them with the blend file, sorry.

Not sure if this is related, but I was trying to use alpha channel from Video file (ProRes 4444) in compositor, but alpha seemed to not be interpreted at all. Let me know if you would like some sample frames and/or .blend.

@Sergey Sharybin (sergey):
Brecht already fixed TIFF and TGA.
Formats that are still affected are: DDS, JPEG2000, IRIS and DPX

I've sent a pull-request for the jpeg2000 issue: https://github.com/OpenImageIO/oiio/pull/943

DPX/IRIS is still to be investigated. As for DDX, do you have sample file?

Sergey Sharybin (sergey) lowered the priority of this task from Normal to Confirmed, Low.

Also, since it's actually a bug in blender, lowering the priority.

Sergey Sharybin (sergey) closed this task as Resolved.Aug 22 2014, 7:58 PM

Ok, looked into the rest of the formats. Few things:

  • DPX non-log is fixed now (rB4ff4bfc)
  • DDS/SGI seems to be updated in the same way as it's done for JP2K in the pull-request (i've added a comment about this)
  • DPX Log actually requires either making Cycles OCIO-aware or using ImBuf. This is one of the possible issues with using non-sRGB/non-linear color space and wouldn't consider this is a bug. Just the thing to be improved.

So all the things which we might fix from blender side are fixed, will continue talking to the OIIO folks in the pull-request. Thanks for the report, closing it now as nothing to be fixed by us now.

Thank you, Sergey! Waiting for the OIIO fixes.

Hi.

I hope this is the right place to post my problem. If not please open a new task.

I have problems using RGBA channels of TGAs in Cycles. I want to use every single color channel of an TGA to work with it individually.
In my case I am writing greyscale informations into the channels, like bumpmap, anisotrophy or roughness. All in one file.

Following a shot with a simple setup show the problem. I've attached the blend file for testing too.

Cycles seem to multiply the Alpha channel informations into all other channels while rendering. But Blenders image editor shows the channels right.

Is it my fault?

I switched to TIF file format to continue my work. TIFs color channels can be read by single.

But it would be good if you check it and fix the problem for the future. There are a lot of people still working with TGA.

Hi @Christoph Werner (Taros),

I tested this on Linux with various file formats and libopenimageio 1.8.12 .

These formats work: dds, dpx, exr, rgba(from SGI)
These formats are broken: tga, png, jp2, tiff

So for me TIFF is broken, and I wonder why it works for you.

Maybe it is better to open a separate bug-report?

Hi @Christoph Werner (Taros),
I tested this on Linux with various file formats and libopenimageio 1.8.12 .
These formats work: dds, dpx, exr, rgba(from SGI)
These formats are broken: tga, png, jp2, tiff
So for me TIFF is broken, and I wonder why it works for you.
Maybe it is better to open a separate bug-report?

I guess I'm not permitted to open a new task here, or can I do it too? If it's possible for me, show me where please?

EDIT: Ok. I found how to open a new task. I will open a new one.