Visualizing Color Distribution within the Frame

You can visualize the color data and analyze the content of the textures and render targets of your frame using the color histogram.

Depending on the format type, the pixel values of your texture/render target could have different default ranges. For floating-point texture formats, the default range is [0, 1]. For integer formats, the range spans from the minimum to the maximum possible value.

If the pixel values you are interested in lie within a range much smaller than the default range, it might be hard to see the details of the image with the naked eye. In this case, try the following:

  1. Select the texture or render target from the list of resources and click the button to open the histogram. The X-axis contains color intensity values, while the Y-axis displays the number of pixels in the image with a given intensity.
  2. Analyze the color distribution within the frame. You can hover over the image to see the pixel values below the image. If the space below the histogram permits, you can also see:
    • The original values used to store pixel information in memory. These are the same values as shown below the image, but in a more precise format.
    • The normalized values used in shaders.
  3. Drill down to the color range with the pixel values you are interested in by clicking and dragging with the mouse pointer in the histogram, or typing the threshold values in the Range Selector below the histogram. The image on the left updates to show the data for the selected range only. All the pixel values get clamped to the selected range, so you can easily analyze the data distribution in the histogram.
  4. If required for better visualization, toggle between the available channel configurations:
    • RGB mode - includes all the available channels. If the alpha channel is present, you can switch it on and off using the toggle button below image.
    • Red/Green/Blue color channels - show the image information in red/green/blue color plane.
    • Alpha Channel - a grayscale conversion of the alpha data of the buffer.

      Switching the channel configuration does not affect the color range selection. The Reset button restores the full default color range for the RGB mode, and the [min, max] range for the selected color plane modes.

    For non-RGB(A) images, the first available channel is selected. For example, only the Depth plane is shown for Depth and Depth–Stencil textures.

  5. Click the Reset button to return the histogram to the full view and select a different range, if needed. You can also zoom in/out of the selected range using the mouse wheel, and scroll left/right by clicking and dragging the mouse while holding Ctrl.

TIP

If the pixel values of your floating-point texture/render target exceed the default range [0, 1], the displayed image might not look as you expect. Using the histogram, you can easily detect the actual range, and then drill down to the sub-range of your interest:

  1. Open the histogram for the selected texture/render target. Since the RGB mode shows the default color range, some of the data is not displayed.
  2. Select one of the available color channels and click Reset. The histogram updates to include the entire available range, with all the pixel values clamped to the actual available range.
  3. Change the color channel back to the RGB mode. Switching color channels does not affect the range selection, so you can now view the full image with the actual range selected.

When analyzing textures/render targets that use 5-6-5 formats, remember to reset the range selection each time you switch the color channels because they have different ranges:

  • [0, 32] for the Red channel
  • [0, 64] for the Green channel
  • [0, 32] for the Blue channel

Since the intensity values for the pixels in the RGB mode are (0.3R + 0.59G + 0.11B), the peak values in the histogram for the RGB channel will not coincide with those for separate color planes.

 

See Also

Resources Pane

For more complete information about compiler optimizations, see our Optimization Notice.