JV_SampleTimer

Diagnostic Shader for sample timing

This document gives you an overview of the JV_SampleTimer shader and its usage. The main purpose of this diagnostic utility, is to visualize the time, each sample (pixel) took to render. With this visual result of the rendering time you can detect where your raydepth setting are to high, for example.

The shader parameters:  

The JV_SampleTimer shader is a Lens shader and has to be applied to the current camera. It has no animatable or texturable parameters.

Enable Calculation - Enables the shader to calculate the time each sample takes to render. If this is turned off, the shader does nothing.

Min/Max Range - These two parameters set the clipping of the timerange (in milliseconds) in which the pixels are colored. The default range lies between 8ms and 64ms.

Enable FG - This enables the shader to calculate how long the Final Gathering Preprocessing takes on each FG ray. You have to enable Final Gathering in your Render settings for this to take effect.

Download the shader here: JV_SampleTimer.zip

 

The shader usage and results:
We are going to analyze this image which was rendered with MR 3.4 from XSI 5.11. The scene is enlightened with three area lights with very high sampling (10x10). Shading is done with the T2S_Illumination shader, with reflection samples set to 16. Reflection depth was set to 3. Final Gathering was calculated with an accuracy of 100, minR 0.5, maxR 2.1, 2 bounces and a presampling density of 2. Antialiasing was set to 0-2.

This image shows the JV_SampleTimer shader in action. It was rendered with the same render settings (except the antialiasing was 0-0) as the original image above. The Min/Max Range parameter was set to 8/64, which means that the blue dots shows samples that rendered with about 8 milliseconds and the magenta dots rendered about 64ms. Samples below 8ms are black and samples above 64ms are white.

You can see how the render time rises at higher reflection depth.

The pixel coloration is linear. This means that blue pixels rendered about 8ms, green pixels about 26ms and red pixels about 45ms. White pixels are "out of range".
One special feature of the shader is that it outputs an 32bit float alpha channel. This happens when you render the image in OpenEXR or a similar format. This is very handy if you wish to set the Min/Max parameters to the right clipping.

Because we don't know how long the white pixels took to render, we open the image in PhotoshopCS2 (supports 32bit images) and check it out there with the Eyedropper/Color Sampler tool.

Now we can see that the white pixel rendered for 109ms at #1K and the other 56ms at #2K. These values can help us now to set the clipping, so we can see what is going on in the white regions of the image.

With the Min Range set to 56 and the Max Range to 110, we are moving the color range higher to see the white pixels colored.
In this image you can see the Final Gathering Points which were generated during the FG preprocessing. The higher your presample density is, the denser this grid will be.
And of course the alpha channel contains the whole time range measured.

If you find these tools helpful, please donate.