Forums > Jitter

problem exporting PNG via jit.gl.asynread/jit.matrix

February 23, 2013 | 9:03 pm

I’m seeing a noticeable decrease in dynamic range when trying to capture a still image of a rendered OpenGL scene that employs alpha blending. I’ve attached an example patch and two images, one a direct screen grab of the render window, the other a PNG generated with the "exportimage" message to jit.matrix. To my eyes the screen grab clearly has a greater dynamic range.

Would anyone care to take a look and point me in the right direction here? The end goal is to be able to capture pixel accurate still captures of my rendered scene.

Mac OSX 10.7.5
Macbook Pro, 2.3Ghz i7
8GB RAM
AMD Radeon HD 6750M

– Pasted Max Patch, click to expand. –

[attachment=215681,5061] [attachment=215681,5062]

Attachments:
  1. matrixexport.png

February 25, 2013 | 9:18 am

I gather after doing some more research that this is an issue with jit.matrix, and is really nothing to do with readback from OpenGL. The export seems to work properly if I specify JPEG or BMP as the file type in the exportimage message. The other formats I’ve tried (PNG, TIFF, TGA, SGI) all have the same dynamic range issue. The PICT format does give the correct dynamic range but resizes to a different pixel resolution, and the file itself won’t open in Photoshop CS5.1.

It would be nice to hear from Cycling why the above uncompressed export formats do not work properly.


February 25, 2013 | 7:05 pm

it seems to be because your context elements contain transparent alpha values.
the matrix export is doing exactly what you tell it, and exporting with transparency (for formats that support it, such as png), and the image viewing app (Preview on the mac) is matting your transparent image with some solid color, probably grey.

either create a fully opaque black background layer, or don’t export a format that supports transparency.

let me know if that doesn’t fix the problem.


February 25, 2013 | 7:41 pm

Thanks for the explanation Rob. Would @erase_color 0. 0. 0. 1. not be a fully opaque black background layer? That’s what I have in the original patch.

I believe I’ve solved this by simply stripping the alpha channel from the jit.matrix coming out of jit.gl.asyncread, and setting it all to 255. That seems to work with any export file format.

– Pasted Max Patch, click to expand. –

February 25, 2013 | 7:45 pm

erase_color isn’t a layer, it’s simply the color that overwrites from frame to frame, and has doesn’t come into play when exporting.
glad you figured it out.


Viewing 5 posts - 1 through 5 (of 5 total)