OpenEXR Converter

Last Page Update: 9/24/2016

convertexr_screenshot1

ConvertEXR is a little tool for converting C4D position_pass exports (OpenEXR format) to custom *.txt or *.bin formats. Made it for my own use, as I had some resolution issues when directly importing EXR files into Unity3D. Now, I’m using the converted data instead (and create a RGBAFloat texture from it within Unity).

The download comes with all required OpenEXR dlls (compiled  code from http://www.openexr.com) and a C4D demo scene. Also, a small Unity3D project is included, showing the *.txt or *.bin import.

How to Export a Position Pass from C4D

A position pass will give us additional information when rendering a picture. Now, we also get the world space position of each rendered pixel (or, to put it in other words: “we know the position in world space that made this pixel the color that it has”).
Later on, this information can be used for depth comparisons of the 2D render picture in 3D setups (at least, this is what I’m doing with it).

Please see the C4D render setup screenshots below, and check  their docs for ‘position pass’.

convertexr_s1

convertexr_s2

When rendering a scene with a position pass, the created pictures would look like so (the position picture is a modified false color png – just to show something similar).

convertexr_p1

convertexr_p2

Files Created by ConvertEXR

For an input OpenEXR file named like ‘Demo_positionpass_1.exr’, ConvertEXR will create 3 output files:

  • Demo_positionpass_1_bin.bytes: Binary export. Contains dimensions of the bitmap (width, height) as two INT32, then RGB pixel data line-by-line (each pixel consists of 3 FLOAT32).
  • Demo_positionpass_1_txt.txt: Text export. Same format as the binary export. A carriage return is inserted after size info and after each RGB value triple.
  • Demo_positionpass_1_checkimage.png: A visualisation of the exported data. This is intended for visual check of exports only (reduced information content).

Downloads

FileFile-DateSizeRemarks
ConvertEXR_1.0.0.zip09/24/201615 MBConvertEXR.exe, EXR dlls, example data output files, C4D scene, unity import example (.unitypackage)