All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UsdMayaColorSpace Namespace Reference

Helper functions for dealing with colors stored in Maya. More...

Functions

PXRUSDMAYA_API bool IsColorManaged ()
 Returns true if we treat colors from Maya as linear colors. More...
 
template<typename T >
ConvertLinearToMaya (const T &linearColor)
 Converts a linear color into the appropriate Maya color space as determined by the above IsColorManaged. More...
 
template<typename T >
ConvertMayaToLinear (const T &mayaColor)
 Converts a Maya color space into a linear color. More...
 

Detailed Description

Helper functions for dealing with colors stored in Maya.

Technically, this doesn't need to be tied to Usd.

Function Documentation

T UsdMayaColorSpace::ConvertLinearToMaya ( const T &  linearColor)

Converts a linear color into the appropriate Maya color space as determined by the above IsColorManaged.

Definition at line 69 of file colorSpace.h.

T UsdMayaColorSpace::ConvertMayaToLinear ( const T &  mayaColor)

Converts a Maya color space into a linear color.

Definition at line 77 of file colorSpace.h.

PXRUSDMAYA_API bool UsdMayaColorSpace::IsColorManaged ( )

Returns true if we treat colors from Maya as linear colors.

Before color management (viewport 1.0), all Maya colors were stored with gamma correction. When we have a mix of shapes we need to draw, some shaded via native Maya and others with our custom shapes, we need to know if the Maya colors are considered linear or not. If things are color correct, our shape needs to write linear colors to the framebuffer and we leave the final correction up to Maya. Otherwise, we want to draw things as if they were modeled in Maya. While this may not be "correct" in all situations, at least it is consistent with native Maya shading.

Currently, this value is controlled via an environment variable:

PIXMAYA_LINEAR_COLORS

You should only be setting that if you've more or less fully switched to Viewport 2.0 (as proper color management is only supported there).