Category:LSL Light
Revision as of 02:59, 6 March 2007 by Strife Onizuka (talk | contribs)
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Light sources
Headline text
Controlling Light sources
Light in SL is determined by the OpenGL standard which allows for eight lights. Traditionally and practically, two sources are reserved for the Sun and Moon, leaving six for incidental lighting. All eight are really generated on the client-side video card, so different video card models may show the same scene slightly differently. If more than six user light sources are present in a scene, only the light from the closest six will show in the environment.
An example - How to generate, switch and change light from LSL:
// simple light source demonstrator // 8feb07 "tetsumo kuri" // thanks to squee janitor for line to dissect integer light_s = TRUE; // "_s" for status default { state_entry() { // llSetText("click me",<1,0,0.6>,.5); // in case you like labels } touch_start(integer total_number) { if ( light_s ) { light_s = FALSE; // fullbright doesn't have anything to do with light in NEW(2006?) lighting model // setting fullbright does look good though llSetPrimitiveParams([PRIM_FULLBRIGHT,ALL_SIDES,FALSE]); llSetPrimitiveParams([PRIM_POINT_LIGHT, FALSE, // if this is false, light is off, <0.0,1.0,0.0>,1.0, 10.0, 0.5]); // rest of params don't matter } else { light_s = TRUE; //llSetPrimitiveParams([PRIM_FULLBRIGHT,ALL_SIDES,TRUE]); //leave fullbright commented for now llSetPrimitiveParams([PRIM_POINT_LIGHT,TRUE, <1.0,0.7,1.0>, // light color vector range: 0.0-1.0 *3 1.0, // intensity (0.0-1.0) 10.0, // radius (.1-10.0) 0.6 ]); // falloff (.01-1.0) // this could have been done in one line, like this //llSetPrimitiveParams([PRIM_FULLBRIGHT,ALL_SIDES,FALSE,PRIM_POINT_LIGHT,TRUE,<1.0,1.0,0.5>,20,1.0,0.5]); // ... but thats kinda hard to take in... } //llSay(0, " Click!"); } }
Pages in category "LSL Light"
The following 14 pages are in this category, out of 14 total.