|  | RenderMan
    26.0
    | 
#include <unordered_map>#include <string>#include "RixShadingUtils.h"#include "pxrcore/ustring/ustring.h"Go to the source code of this file.
| Macros | |
| #define | F_LOGDOTFIVE (-0.30102999566f) | 
| #define | F_INVLOGDOTFIVE (-3.32192809489f) | 
| #define | IFLOOR(x) (((x) < 0.0f && (x) != (int)(x)) ? (int)x - 1 : (int)x) | 
| Enumerations | |
| enum | RixColorSpace { k_sRGB = 0, k_Rec709, k_Rec2020, k_DCI_P3, k_Alexa_wide, k_ACEScg, k_CinemaGamut, k_NTSC, k_numColorSpaces } | 
| enum | RenderColorSpace { kScene =-1, kRec709 =0, kACEScg =1, kNumColorSpaces } | 
| Functions | |
| PRMAN_INLINE RtColorRGB | RixToColorSpace (const RenderColorSpace &from, const RenderColorSpace &to, const RtColorRGB &rgb) | 
| PRMAN_INLINE RenderColorSpace | RixGetSceneColorSpace (RixContext const &ctx) | 
| PRMAN_INLINE void | RixHsvToRgb (RtColorRGB const &hsv, RtColorRGB &rgb) | 
| PRMAN_INLINE void | RixRgbToHsv (RtColorRGB const &rgb, RtColorRGB &hsv) | 
| PRMAN_INLINE float | rixValue (float n1, float n2, float hue) | 
| PRMAN_INLINE void | RixHslToRgb (RtColorRGB const &hsl, RtColorRGB &rgb) | 
| PRMAN_INLINE void | RixRgbToHsl (RtColorRGB const &rgb, RtColorRGB &hsl) | 
| PRMAN_INLINE void | RixXyzToRgb (RtColorRGB const &xyz, RtColorRGB &rgb, RixColorSpace cs=k_sRGB) | 
| PRMAN_INLINE void | RixRgbToXyz (RtColorRGB const &rgb, RtColorRGB &xyz, RixColorSpace cs=k_sRGB) | 
| PRMAN_INLINE RtFloat | RixInputRange (const RtFloat &f, const RtFloat &min, const RtFloat &max) | 
| Remap [min, max] to [0.0 to 1.0].  More... | |
| PRMAN_INLINE RtColorRGB | RixInputRange (const RtColorRGB &rgb, const RtFloat &min, const RtFloat &max) | 
| Remap [min, max] to [0.0 to 1.0].  More... | |
| template<typename T > | |
| PRMAN_INLINE RtColorRGB | RixInputRange (const RtColorRGB &rgb, const T &min, const T &max) | 
| Remap [min, max] to [0.0 to 1.0].  More... | |
| PRMAN_INLINE RtFloat | RixOutputRange (const RtFloat &f, const RtFloat &min, const RtFloat &max) | 
| Remap a float from [0.0, 1.0] to [min, max].  More... | |
| PRMAN_INLINE RtColorRGB | RixOutputRange (const RtColorRGB &rgb, const RtFloat &min, const RtFloat &max) | 
| Remap a color from [0.0, 1.0] to [min, max].  More... | |
| template<typename T > | |
| PRMAN_INLINE RtColorRGB | RixOutputRange (const RtColorRGB &rgb, const T &min, const T &max) | 
| Remap a color from [0.0, 1.0] to [min, max].  More... | |
| PRMAN_INLINE RtFloat | RixExposure (float const &f, float const &e) | 
| Float exposure function.  More... | |
| PRMAN_INLINE RtColorRGB | RixExposure (const RtColorRGB &rgb, const RtFloat &e) | 
| Color exposure function.  More... | |
| template<typename T > | |
| PRMAN_INLINE RtColorRGB | RixExposure (const RtColorRGB &rgb, const T &e) | 
| Color exposure function.  More... | |
| PRMAN_INLINE RtFloat | RixGamma (const RtFloat &f, const RtFloat &g) | 
| Float gamma correction.  More... | |
| PRMAN_INLINE RtColorRGB | RixGamma (const RtColorRGB &rgb, const RtFloat &g) | 
| Color gamma correction.  More... | |
| template<typename T > | |
| PRMAN_INLINE RtColorRGB | RixGamma (const RtColorRGB &rgb, const T &g) | 
| Color gamma correction.  More... | |
| PRMAN_INLINE RtFloat | RixContrast (float f, float contrast, float pivot) | 
| Contrast float function.  More... | |
| template<typename T > | |
| PRMAN_INLINE RtColorRGB | RixContrast (const RtColorRGB &rgb, const T &contrast, const T &pivot) | 
| Color contrast function.  More... | |
| PRMAN_INLINE RtColorRGB | RixHsvCorrect (const RtColorRGB &rgb, const RtFloat &hue, const RtFloat &sat, const RtFloat &val) | 
| HSV color correction.  More... | |
| template<typename T > | |
| PRMAN_INLINE RtColorRGB | RixHsvCorrect (const RtColorRGB &rgb, const T &hsv) | 
| HSV color correction.  More... | |
| template<typename T > | |
| PRMAN_INLINE RtColorRGB | RixHslCorrect (const RtColorRGB &rgb, const T &hsl) | 
| HSL color correction.  More... | |
| template<typename T > | |
| PRMAN_INLINE RtColorRGB | RixColorClamp (const RtColorRGB &rgb, const T &min, const T &max) | 
| Clamp color : this an extensions of RixClamp.  More... | |
| PRMAN_INLINE RtColorRGB | RixSaturation (const RtColorRGB &rgb, const float saturation) | 
| Return the saturation-adjusted color.  More... | |
| PRMAN_INLINE void | RixSaturation (RtColorRGB &rgb, const float saturation) | 
| Adjust the color saturation of the passed color.  More... | |
| #define F_INVLOGDOTFIVE (-3.32192809489f) | 
| #define F_LOGDOTFIVE (-0.30102999566f) | 
Referenced by RixContrast().
| #define IFLOOR | ( | x) | (((x) < 0.0f && (x) != (int)(x)) ? (int)x - 1 : (int)x) | 
Referenced by RixHsvToRgb().
| enum RenderColorSpace | 
| enum RixColorSpace | 
| PRMAN_INLINE RtColorRGB RixColorClamp | ( | const RtColorRGB & | rgb, | 
| const T & | min, | ||
| const T & | max | ||
| ) | 
Clamp color : this an extensions of RixClamp.
| [in] | rgb | The rgb input | 
| [in] | min | The minimum color | 
| [in] | max | The maximum color | 
| T | Any RtFloat3 container | 
References RixClamp().
| PRMAN_INLINE RtFloat RixContrast | ( | float | f, | 
| float | contrast, | ||
| float | pivot | ||
| ) | 
Contrast float function.
| [in] | f | input float value | 
| [in] | contrast | The amount of contrast, from -1 to 1. 0 is neutral. | 
| [in] | pivot | The pivot value of the contrast curve. | 
References F_LOGDOTFIVE, RixClamp(), and RixMin().
Referenced by RixContrast().
| PRMAN_INLINE RtColorRGB RixContrast | ( | const RtColorRGB & | rgb, | 
| const T & | contrast, | ||
| const T & | pivot | ||
| ) | 
Color contrast function.
| [in] | rgb | The rgb input | 
| [in] | contrast | The contrast value between -1 and +1 | 
| [in] | pivot | The pivot of the contrast curve. | 
| T | Any RtFloat3 container. | 
References RixContrast().
| PRMAN_INLINE RtFloat RixExposure | ( | float const & | f, | 
| float const & | e | ||
| ) | 
Float exposure function.
| f | float input value | 
| e | exposure value. | 
Referenced by RixExposure().
| PRMAN_INLINE RtColorRGB RixExposure | ( | const RtColorRGB & | rgb, | 
| const RtFloat & | e | ||
| ) | 
Color exposure function.
| [in] | rgb | The rgb input | 
| [in] | e | The float exposure value | 
| PRMAN_INLINE RtColorRGB RixExposure | ( | const RtColorRGB & | rgb, | 
| const T & | e | ||
| ) | 
Color exposure function.
| [in] | rgb | The rgb input | 
| [in] | e | The T exposure value | 
| T | Any RtFloat3 container | 
References RixExposure().
| PRMAN_INLINE RtFloat RixGamma | ( | const RtFloat & | f, | 
| const RtFloat & | g | ||
| ) | 
Float gamma correction.
| [in] | f | The float input value | 
| [in] | g | The float gamma value | 
References RixMax().
Referenced by RixGamma().
| PRMAN_INLINE RtColorRGB RixGamma | ( | const RtColorRGB & | rgb, | 
| const RtFloat & | g | ||
| ) | 
Color gamma correction.
| [in] | rgb | The rgb input | 
| [in] | g | The float gamma value | 
References RixMax().
| PRMAN_INLINE RtColorRGB RixGamma | ( | const RtColorRGB & | rgb, | 
| const T & | g | ||
| ) | 
Color gamma correction.
| [in] | rgb | The rgb input | 
| [in] | g | The T gamma value | 
| T | Any RtFloat3 container | 
References RixGamma().
| PRMAN_INLINE RenderColorSpace RixGetSceneColorSpace | ( | RixContext const & | ctx) | 
| PRMAN_INLINE RtColorRGB RixHslCorrect | ( | const RtColorRGB & | rgb, | 
| const T & | hsl | ||
| ) | 
HSL color correction.
| [in] | rgb | The rgb input | 
| [in] | hsl | The hsl values. | 
| T | Any RtFloat3 container | 
References RixClamp(), RixFractional(), RixHslToRgb(), and RixRgbToHsl().
| PRMAN_INLINE void RixHslToRgb | ( | RtColorRGB const & | hsl, | 
| RtColorRGB & | rgb | ||
| ) | 
References rixValue().
Referenced by RixHslCorrect().
| PRMAN_INLINE RtColorRGB RixHsvCorrect | ( | const RtColorRGB & | rgb, | 
| const RtFloat & | hue, | ||
| const RtFloat & | sat, | ||
| const RtFloat & | val | ||
| ) | 
HSV color correction.
| [in] | rgb | The rgb input | 
| [in] | hue | The hue offset | 
| [in] | sat | The saturation multiplier | 
| [in] | val | The value multiplier | 
References RixClamp(), RixFractional(), RixHsvToRgb(), and RixRgbToHsv().
| PRMAN_INLINE RtColorRGB RixHsvCorrect | ( | const RtColorRGB & | rgb, | 
| const T & | hsv | ||
| ) | 
HSV color correction.
Hue, saturation and value are packed in a RtFloat3 container.
| [in] | rgb | The rgb input | 
| [in] | hsv | The hsv values in a RtFloat3 container. | 
| T | Can be any RtFloat3 container. | 
References RixClamp(), RixFractional(), RixHsvToRgb(), and RixRgbToHsv().
| PRMAN_INLINE void RixHsvToRgb | ( | RtColorRGB const & | hsv, | 
| RtColorRGB & | rgb | ||
| ) | 
References IFLOOR.
Referenced by RixHsvCorrect().
| PRMAN_INLINE RtFloat RixInputRange | ( | const RtFloat & | f, | 
| const RtFloat & | min, | ||
| const RtFloat & | max | ||
| ) | 
Remap [min, max] to [0.0 to 1.0].
| [in] | f | The input float value | 
| [in] | min | The float value that will be remapped to 0.0 | 
| [in] | max | The float value that will be remapped to 1.0 | 
Referenced by RixInputRange().
| PRMAN_INLINE RtColorRGB RixInputRange | ( | const RtColorRGB & | rgb, | 
| const RtFloat & | min, | ||
| const RtFloat & | max | ||
| ) | 
Remap [min, max] to [0.0 to 1.0].
| [in] | rgb | The input color value | 
| [in] | min | The float value that will be remapped to 0.0 | 
| [in] | max | The float value that will be remapped to 1.0 | 
References RixInputRange().
| PRMAN_INLINE RtColorRGB RixInputRange | ( | const RtColorRGB & | rgb, | 
| const T & | min, | ||
| const T & | max | ||
| ) | 
Remap [min, max] to [0.0 to 1.0].
| [in] | rgb | The input color value | 
| [in] | min | The T value that will be remapped to 0.0 | 
| [in] | max | The T value that will be remapped to 1.0 | 
| T | Any RtFloat3 container. | 
References RixInputRange().
| PRMAN_INLINE RtFloat RixOutputRange | ( | const RtFloat & | f, | 
| const RtFloat & | min, | ||
| const RtFloat & | max | ||
| ) | 
Remap a float from [0.0, 1.0] to [min, max].
| [in] | f | The input float value | 
| [in] | min | The float value to which 0.0 will be remapped. | 
| [in] | max | The float value to which 1.0 will be remapped. | 
Referenced by RixOutputRange().
| PRMAN_INLINE RtColorRGB RixOutputRange | ( | const RtColorRGB & | rgb, | 
| const RtFloat & | min, | ||
| const RtFloat & | max | ||
| ) | 
Remap a color from [0.0, 1.0] to [min, max].
| [in] | rgb | The input rgb | 
| [in] | min | The float value to which 0.0 will be remapped. | 
| [in] | max | The float value to which 1.0 will be remapped. | 
References RixOutputRange().
| PRMAN_INLINE RtColorRGB RixOutputRange | ( | const RtColorRGB & | rgb, | 
| const T & | min, | ||
| const T & | max | ||
| ) | 
Remap a color from [0.0, 1.0] to [min, max].
| [in] | rgb | The input rgb | 
| [in] | min | The T value to which 0.0 will be remapped. | 
| [in] | max | The T value to which 1.0 will be remapped. | 
| T | Any RtFloat3 container. | 
References RixOutputRange().
| PRMAN_INLINE void RixRgbToHsl | ( | RtColorRGB const & | rgb, | 
| RtColorRGB & | hsl | ||
| ) | 
Referenced by RixHslCorrect().
| PRMAN_INLINE void RixRgbToHsv | ( | RtColorRGB const & | rgb, | 
| RtColorRGB & | hsv | ||
| ) | 
Referenced by RixHsvCorrect().
| PRMAN_INLINE void RixRgbToXyz | ( | RtColorRGB const & | rgb, | 
| RtColorRGB & | xyz, | ||
| RixColorSpace | cs = k_sRGB | ||
| ) | 
References k_numColorSpaces.
| PRMAN_INLINE RtColorRGB RixSaturation | ( | const RtColorRGB & | rgb, | 
| const float | saturation | ||
| ) | 
Return the saturation-adjusted color.
| [in] | rgb | The rgb input | 
| [in] | saturation | 0.0 is monochrome (fully desaturated), 1.0 is the original color, values > 1.0 increase color saturation. | 
References RixMax().
| PRMAN_INLINE void RixSaturation | ( | RtColorRGB & | rgb, | 
| const float | saturation | ||
| ) | 
Adjust the color saturation of the passed color.
| [in] | rgb | The rgb input | 
| [in] | saturation | 0.0 is monochrome (fully desaturated), 1.0 is the original color, values > 1.0 increase color saturation. | 
References RixMax().
| PRMAN_INLINE RtColorRGB RixToColorSpace | ( | const RenderColorSpace & | from, | 
| const RenderColorSpace & | to, | ||
| const RtColorRGB & | rgb | ||
| ) | 
References kScene.
| PRMAN_INLINE float rixValue | ( | float | n1, | 
| float | n2, | ||
| float | hue | ||
| ) | 
Referenced by RixHslToRgb().
| PRMAN_INLINE void RixXyzToRgb | ( | RtColorRGB const & | xyz, | 
| RtColorRGB & | rgb, | ||
| RixColorSpace | cs = k_sRGB | ||
| ) | 
References k_numColorSpaces.