vray.Color¶
- class vray.Color¶
Bases:
object
A 3-component floating point color value. It supports mathematical operations, indexing and equality checking. In most contexts the component values are in the range (0; 1), but in lighting calculations HDR values above 1.0 are possible. This object is immutable.
Color() -> new Color with value (0, 0, 0)
Color(red, green, blue) -> new Color full constructor
Attributes
Color blue component
Color green component
Color red component
Methods
__init__
()Creates a color with R, G and B values converted from sRGB to linear values.
Creates a color with components equal to the normalized RGB color of a black body with the given temperature in Kelvin.
Finds the black body color that is closest to the given color and returns its temperature in Kelvin.
Finds the black body color that is closest to the given color and returns it and its temperature in Kelvin.
Returns the intensity of the color (also called chroma or saturation) which is the brightness or dullness of a color.
Returns the length of the color.
Returns the squared length of the color.
Returns the luminance of the color which is a measure of the intensity of light that reaches the eye.
Returns the sum of all color components.
Compute the rgb to rgb transformation matrix between two linear color spaces This is an expensive operation and you should cache the matrix if possible
Returns the white complement of the Color.
Applies a contrast correction to the color and returns the enw color.
(De)saturates the given color and returns the new color.
Creates a color with R, G and B values converted from (presumably) linear to sRGB values.
- fromSRGB()¶
Creates a color with R, G and B values converted from sRGB to linear values. Returns the created Color.
- static fromTemperature()¶
Creates a color with components equal to the normalized RGB color of a black body with the given temperature in Kelvin.
temperature The color temperature in Kelvin.
rgbColorSpace The color space to use from
[vray.Color.COLOR_SPACE_CIE, vray.Color.COLOR_SPACE_SRGB, vray.Color.COLOR_SPACE_ACEScg]
Returns the created Color.
- getClosestTemperature()¶
Finds the black body color that is closest to the given color and returns its temperature in Kelvin.
rgbColorSpace The color space to use from
[vray.Color.COLOR_SPACE_CIE, vray.Color.COLOR_SPACE_SRGB, vray.Color.COLOR_SPACE_ACEScg]
Returns a number.
- getClosestTemperatureAndColor()¶
Finds the black body color that is closest to the given color and returns it and its temperature in Kelvin.
rgbColorSpace The color space to use from
[vray.Color.COLOR_SPACE_CIE, vray.Color.COLOR_SPACE_SRGB, vray.Color.COLOR_SPACE_ACEScg]
Returns a tuple with two elements.
- getIntensity()¶
Returns the intensity of the color (also called chroma or saturation) which is the brightness or dullness of a color.
Returns the intensity of the color.
- getLength()¶
Returns the length of the color.
- getLengthSquared()¶
Returns the squared length of the color.
- getLuminance()¶
Returns the luminance of the color which is a measure of the intensity of light that reaches the eye.
Returns the luminance of the color.
- getPower()¶
Returns the sum of all color components.
- static getRGBToRGBMatrix()¶
Compute the rgb to rgb transformation matrix between two linear color spaces This is an expensive operation and you should cache the matrix if possible
srcColorSpace Source RGB color space from
[vray.Color.COLOR_SPACE_CIE, vray.Color.COLOR_SPACE_SRGB, vray.Color.COLOR_SPACE_ACEScg]
dstColorSpace Destination RGB color space from
[vray.Color.COLOR_SPACE_CIE, vray.Color.COLOR_SPACE_SRGB, vray.Color.COLOR_SPACE_ACEScg]
Returns Matrix that converts from source to destination.
- getWhiteComplement()¶
Returns the white complement of the Color.
Note that this will clamp (restrict a number between two other numbers) the color from below (e.g. no component will be below zero).
- setContrast()¶
Applies a contrast correction to the color and returns the enw color.
k double number: the contrast scale - 1.0 leaves the color unchanged and 0.0 makes the color equal to the middle
middle double number: an optional argument the contrast base - the level that remains unchanged (default value set to 0.5)
- setSaturation()¶
(De)saturates the given color and returns the new color.
k double number: for k=0.0 means color is greyed; for k=1.0 means the color is unchanged; for k>1.0 adds more color
- toSRGB()¶
Creates a color with R, G and B values converted from (presumably) linear to sRGB values. Returns the created Color.
- COLOR_SPACE_ACEScg = 2¶
- COLOR_SPACE_CIE = 0¶
- COLOR_SPACE_SRGB = 1¶
- b¶
Color blue component
- g¶
Color green component
- r¶
Color red component