Render normals and modifiers with rtpict

Hi all,

I’m experimenting with denoising images with Intel Open Image Denoiser. To produce great results I need an albedo map and a normals map. I think the albedo map could also be an image with one random color per object (or per modifier).

My idea is to use rtpict to generate various outputs in one go, however I’m unsure how to convert the nrm and idx files into rgb jpg/png.
documentation reads:
Different encodings are associated with different data types. Color data (from the ’v’, ’r’, and ’x’ types) will be converted to a flat RGBE picture by pvalue(1). Distances (from the ’l’, ’L’, ’R’, and ’X’ types) will be converted to a 16-bit representation by rcode_depth(1), and the −d option should be used to assign the reference (median) depth and world units, which applies to the overall scene. Surface normals (from the ’n’ and ’N’ types) will be converted to a 32-bit representation by rcode_normal(1). Finally, identifiers (from the ’s’, ’m’, and ’M’ types) will be converted to a 16-bit index format by rcode_ident(1). If the −i option is used to turn on irradiane output, then the picture associated with the ’v’ type will be renamed irradiance.hdr and some other output types become irrelevant (i.e., ’r’, ’x’, ’R’, and ’X’). If one or more of the associated output files already exists in the destination directory, it will be overwritten with the new data.
But I’m slightly unsure what that actually means :slight_smile:

  • How can I convert these IDX/NRM outputs? I’m not a big rcalc expert either, if that is needed (yet…)

Workaround for normals could be a colorfunc ( Rendering of normal map - #3 by Claus_B_Madsen1 ) but afaik that requires me to make a new octree for that render and I’m looking for something quick and interactive like ClimateStudio has accomplished (with the above denoiser).

  • Any way to override all modifiers in an octree without using !xform -m to generate rad files and recreate the octree?

Example input images for the denoiser:

Repo for denoiser wrapper: GitHub - DeclanRussell/IntelOIDenoiser: A simple implementation of Intels Open Image denoiser ->

Looks like this denoiser needs normal map in .pfm format, you can roll one like so:

echo PF\\n512 512\\n-1.0000 > perturbed.pfm
rcode_norm -r -ho -ff perturbed.nrm >> perturbed.pfm

You should replace 512 with your image resolution. (\\n syntax here might not work for you shell)
This would generate a normal map that’s flipped vertically, which means you’d probably also want to flip your noisy input image and flip back the denoised image. You can flip your input image and generate the a .pfm file in a similar way:

echo PF\\n512 512\\n-1.0000 > radiance.pfm
pvalue -h -H -df radiance.hdr >> radiance.pfm

Getting the output from .pfm to .hdr you can use ra_pfm (a C-shell script), or:

tail +4 output.pfm | pvalue -r -h -df +y 512 +x 512 > output.hdr

Nice. You may need a -Ho option to the rcode_norm command if the output is taken from rtpict, otherwise you’ll have a resolution string in there messing up the .pfm output. You can also do something more fancy/automatic with sed or awk if you’re on Unix.


wow thanks both. I’ll share the results when I get it running :slight_smile: