Surface Normals
The surface normals camera is a view that renders the ground truth surface normals of the objects visible in the field of view as RGB colors. This is useful for viewpoint estimation, path planning and other tasks that require the 3D geometry of the scene.
Because the normal vectors at any pixel are 3D vectors with components in the range of [-1, 1], they are encoded as RGB colors by simply scaling and shifting the components to the range of [0, 255]. The normal vector (0, 0, 1) is encoded as the color (128, 128, 255), the normal vector (0, 0, -1) is encoded as the color (128, 128, 0), and so on. The encoding is represented as:
r = round(0.5x + 0.5) * 255
g = round(0.5y + 0.5) * 255
b = round(0.5z + 0.5) * 255
And hence, to obtain the true normal vectors from the RGB colors, the following decoding should be used:
x = (r / 255.0) * 2 - 1
y = (g / 255.0) * 2 - 1
z = (b / 255.0) * 2 - 1