Environment Light Orientation
Environment Light Orientation
July 2015
Introduction
There are several factors in play when determining the orientation of an environment light:
- Light transform
- Default orientation of the "envsphere" primitive
- Notion of "up" in the environment light shader
- Characteristics of the environment map (if applicable)
Light Transform
The transform of the light as represented by the graphics state current transformation. For the purposes of this document we will assume that the light transform is identity:
TransformBegin Identity AreaLightSource "PxrStdEnvLight" ... Geometry "envsphere" ... TransformEnd
Default orientation of the "envsphere" primitive
Internally PRMan's "envsphere" primitive uses the +Z axis as its "up" axis.
Notion of "up" in the environment light shader
Light shaders can also have their own notion of a coordinate space. This coordinate space would then be modified by the light transform.
Currently the two Pxr environment light shaders differ in their notion of "up" which requires the user (or the bridge product) to apply an extra rotation in order to obtain a final render which is oriented upright by default.
Shader | Default 'up' Axis | Rotation |
---|---|---|
PxrStdEnvDayLight (PxrEnvDayLight) | +Y | X +90 |
PxrStdEnvMapLight (PxrEnvMapLight) | +Z | X -90 |
Characteristics of the environment map (if applicable)
In the case of environment maps we also need to take into account the orientation and characteristics of the texture itself. Specifically we need to take care with latitude-longitude texture maps.
Lat Long: EXR vs Pixar
With latlong texture maps the environment sphere is mapped to a the texture with the map's S coordinate representing longitude (from 0 to 360 degrees) and the T coordinate representing latitude (from -90 to 90 degrees). The latlong spec differs between Pixar and OpenEXR which can result in a shifting of the environment map visualization if this is not taken into account.
- EXR latlong
The pixel in the upper left corner of the data window has latitude +π/2 and longitude +π; the pixel in the lower right corner has latitude -π/2 and longitude -π. In 3D space, latitudes -π/2 and +π/2 correspond to the negative and positive y direction. Latitude 0, longitude 0 points in the positive z direction; latitude 0, longitude π/2 points in the positive x direction:
- Pixar latlong
The pixel in the upper left corner of the data window has latitude +π/2 and longitude 0; the pixel in the lower right corner has latitude -π/2 and longitude 2π. The bottom of the picture is at the south pole and the top the north pole. A left-handed coordinate system is also assumed such that the center of the texture is considered to be down the negative Z axis.
Notice that latitude-longitude environment maps are sensitive to the handedness of the coordinate system in which they will be accessed. Environment maps that are intended to be accessed in a right-handed coordinate system will, if displayed, appear as a mirror image of those intended to be accessed in a left-handed coordinate system.