Skip to content

llsRGB2Linear

vector llsRGB2Linear(vector srgb)

Converts a color from the sRGB to the linear colorspace.

Parameters
srgb (vector)
A color in the sRGB colorspace.

Lights in Second Life are specified in LSL as linear red, green, blue values in the range (0.0, 1.0). Internally, light calculations are performed in the sRGB colorspace.

The sRGB (Standard Red Green Blue) colorspace is defined in IEC 61966-2-1:1999 and was developed as a joint project between Microsoft and HP.

This calculation is known as an Electro-Optical Transfer Function (EOTF).

  • Naming Confusion: The name of this function is actually a misnomer. LSL color is actually in Rec.709 space, not sRGB space. While they are very similar, the gamma value for sRGB is approximately 2.2, whereas the gamma value for Rec.709 is approximately 2.4.

  • PBR Viewer Scripting: If you enter color vectors manually using the viewer’s color picker, enter them as sRGB values. The color picker automatically converts them internally to Linear RGB, so someone using a PBR-enabled viewer will see them correctly. When you apply color vectors directly with a script, however, you must apply sRGB to Blinn-Phong textured faces and Linear RGB to PBR materials.

  • [llLinear2sRGB] - Convert from the linear colorspace to sRGB (inverse EOTF)