Skip to content
lsl.devlsl.devLSL Dev

LlsRGB2Linear

Looking for the current API? Open the llsRGB2Linear reference →

Return value notes

Returns a vector Transforms a color specified in the sRGB colorspace to the linear RGB colorspace.

Specification

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).

Caveats

  • The name of this function is actually a misnomer as LSL color is actually in Rec.709 space, not sRGB space. While they are very similar, the gamma value for sRGB is approx. 2.2, whereas the gamma value for Rec.709 is approx. 2.4.
  • Scripting for PBR-enabled viewers: 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.

See also: functions

To convert from the Linear colorspace to sRGB. (Inverse EOTF)
Original wiki source

Some wiki templates and tables need their original context. View this article on the Second Life Wiki. Technical wording and examples are retained from the source; historical guidance may differ from current behavior.

From the Second Life Wiki

Community documentation adapted from LlsRGB2Linear, by Linden Research, Inc. and contributing residents.View contributors and history.

Imported wiki revision:

Licensed under CC BY-SA 3.0. Last wiki edit: .Formatting and links have been adapted for this site; API metadata follows the LSL definitions.