Images exported from OSPRay renders have channel values that max out at 254

I’ve encountered two instances that suggest there’s some funny truncating taking place somewhere in either OSPRay or the OSPRay/VTK interface. Essentially, it comes down to the fact that colors are not coming back quite right.

Case 1:

  • Set the ospray render node to “scivis”
  • Set the background to some arbitrary value (e.g., 230, 240, 250) as a normalized color(e.g., 230 / 255.0, etc.).
  • Render an empty scene
  • Export the image.

The image should be full of (230, 240, 250)-valued pixels. What you actually get is (229, 239, 249). However if I take my normalized color as:
(r + 0.5) / 255, (g + 0.5) / 255, (b + 0.5) / 255, I get the correct background color out.

Case 2:

  • Set the render node to “pathtracer”
  • set per simple samples to 1.
  • Put some arbitrary simply geometry in front of the camera.
  • Shine a light on it and create some insanely high intensity for the camera – the goal is to clearly flood the scene such that we get a white out.
  • Render
  • Export image
  • The color saturates, not to (255, 255, 255) but to (254, 254, 254).

This could still be a truncation error (i.e., any value, even a slight epsilon below 1 will end up converting to 254), although that seems highly unlikely with a single sample per pixel and intensity ranked to the sky. I’d hope it would cleanly saturate to 1 and then directly map to 255.