This is related to this post on 3Delight and OpenEXR. While the feature is hidden away inside 3Delight, it’s much more accessible inside VRay. It also includes some common attributes like fstop, focal length and clipping planes automatically to the EXR – but it seems to (at least in the version I’m using) to get these all wrong. Luckily it gets our custom metadata right.
In order to add additional metadata, go into the Image Format Options. There is a little string entry field called Extra Attributes for adding metadata to your rendered EXRs.
You can either manually enter values in here like so along the lines of [attrname1]=[value1];[attrname2]=[value2]; but it would make much more sense to dynamically lookup these values. For example, using the following as a Pre-Render-MEL script would add two new pieces of metadata called fstop and focalDistance to our rendered EXR.
string $extras = "";
float $fstop = `getAttr perspShape.fStop`;
float $focusdistance = `getAttr perspShape.focusDistance`;
$extras += ("fstop=" + $fstop + ";");
$extras += ("focalDistance=" + float ($focusdistance) + ";");
setAttr vraySettings.imgOpt_exr_attributes -type "string" $extras;
Using the above MEL as a template it should be possible to add more metadata quite easily.