Generating a histogram in POV-Ray

POV-Ray has the capability to produce a bitmap histogram, detailing the time required to draw each pixel in the rendering of an image. This is done with the command-line argument "+HTx" (not case-specific), where "x" is a letter specifying the file type for the histogram bitmap.

For example, executing POV-Ray with command-line arguments
povray [...] +oprettypicture +fn8 +htn [...]
will result in two output files:

Here is an example of a rendered image (on the left), and its associated histogram.

The lighter pixels in the histogram indicate longer time required to draw the corresponding pixels in the rendered image.

Animating the histogram

Problem: POV-Ray does not have a built-in means of creating an animation from the series of histograms produced while rendering an animated scene. Each histogram is given the same filename—filename.[ext], where filename is either the default histgram or a name defined by the user.

Solution: POV-Ray does allow the user to "shell-out to the operating system" at the end of a frame render (among other key points). I use this feature to rename the file histgram.png at the end of each frame render.

For my specific purposes, the solution is implemented with the following POV-Ray .ini file statement:

Post_Frame_Command=c:\progra~1\irfanview\i_view32 c:\usr\povscn\histgram.png /invert /convert=c:\usr\povscn\%s%n.png

(POV-Ray provides for string substitution in these "shell-out" commands. The above statement processes the histogram image and uses "%s" and "%n" to save it to mypath\scene_name+frame_number.)