rcode_norm - encode/decode 32-bit surface normal map
[ -h[io] ][ -H[io] ][
-f[afd] ][ -x xr -y yr ] [ input
rcode_norm -r [ -i ][ -u ][ -h[io] ][ -H[io] ][ -f[afd] ] [ input.nrm [output] ]
Rcode_norm reads a map of direction vectors and encodes them in an efficient 32-bit/pixel format. Input is taken from the first named file, or standard input if no files are given. Output is sent to the second named file, or standard output if none.
The -hi option tells rcode_norm not to expect an information header on its input. The -ho option tells rcode_norm not to produce an information header on its output. Specifying -h turns both input and output headers off. Similarly, the -Hi option says not to expect an image resolution string on input, the -Ho option says not to produce one on output, and -H applies both. The -x and -y options give the horizontal and vertical map dimensions, respectively. If provided, then an input resolution string will not be expected.
The default input format is ASCII (user-readable) real triplets, corresponding to the -fa option. The -ff option tells rcode_norm to expect three binary, 32-bit floating-point values per normal on its input, instead. The -fd option tells it to expect 64-bit/component vectors.
The second form applies the -r option to perform a reverse conversion, decoding 32-bit normal directions on the input and producing one of the above formats on output. The -h and -H options have the same behavior as before.
When decoding, the -i option tells rcode_norm to produce one depth or world point for each integer input pair specifying the horizontal and vertical coordinates of a particular pixel, where x is measured from 0 on the left and y from 0 at the bottom in the standard orientation. Note that -i implies that an encoded normal file is explicitly given on the command line, since the pixel coordinates are read from the standard input. Also, the -H option is not supported with -i, since the map dimensions are required on the input and not copied to the output. If the -u option is also given, output will be flushed after each normal.
To store float surface normals out of rtrace:
rtrace -ff < rays.flt -x 512 -y 400 -oN octree | rcode_norm -ff > norms.nrm
To query specific normals using ximage with the ’t’ command:
ximage -op render.hdr | rcode_norm -i -r norms.nrm
rcalc(1), rcode_depth(1), rcode_ident(1), rcode2bmp(1), rcrop(1), rlam(1), rsplit(1), rtpict(1)