Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Lighting Issues

Valradica Vanek
Registered User
Join date: 1 Aug 2006
Posts: 78
09-27-2006 06:14
I am trying to get a clear example of how to set up a light that actually illuminates other objects (say at midnight) I have read through the wiki and searched all the lighting stuff I could find, but it still doesn't work. below is the DoLight fragment of my code. I assign the values of the variables elsewhere. The lights turn on and off, but I am having a problem getting the difference between a "light source" (that illuminates the area around the light) and the LightBright parameter for prim surfaces, which just make the prim as bright as possible.

Any help would be great.

BTW, how does one put code fragments like this into the nice parsed form [IMG]that I see in all the other postings. couldn't figure it out.


//this is a lighting script that turns on lights that are listening for the message
//from channel 0

vector LightColor= < .5,1,1>; //default color is light yellow
integer LightBright = FALSE;
//TRUE = light color is fullbright; FALSE = Light color is not fullbright;
integer LightState = FALSE;
//TRUE = Lights cast light; FALSE = Lights glow

DoLights() {

if (LightState == FALSE and LightBright == FALSE) { //lights are off - light gray
llSetPrimitiveParams([PRIM_COLOR, ALL_SIDES, <.8,.8,.8>, 0.75]);
}
else { //set the color to the LightColor color
llSetPrimitiveParams([PRIM_COLOR, ALL_SIDES, LightColor, 0.75]);
}

// determine if the light is light emitting or just a bright material
if (LightState == FALSE) {
//Set the prim material to glass (not light emitting
llSetPrimitiveParams([PRIM_MATERIAL, PRIM_MATERIAL_GLASS]);
llSetPrimitiveParams([PRIM_POINT_LIGHT, FALSE, <1, 1, 1>, 1.0, 10.0, 0.75]);
}
else {
//Set the prim material to light emitting
llSetPrimitiveParams([PRIM_MATERIAL, PRIM_MATERIAL_LIGHT]);
llSetPrimitiveParams([PRIM_POINT_LIGHT, TRUE, <1, 1, 1>, 1.0, 10.0, 0.75]);
}

//color fullbright or not depending on value of LightBright
llSetPrimitiveParams([PRIM_FULLBRIGHT, ALL_SIDES, LightBright]);

}
Cottonteil Muromachi
Abominable
Join date: 2 Mar 2005
Posts: 1,071
09-27-2006 07:24
Best to post this in the scripting threads as well.
Chosen Few
Alpha Channel Slave
Join date: 16 Jan 2004
Posts: 7,496
09-27-2006 09:59
From: Valradica Vanek
I am trying to get a clear example of how to set up a light that actually illuminates other objects

There are three things that need to happen in order for you to see a prim to cast light onto its surroundings:
  1. The prim has to be set to emit light either via the Features tab in the editor window, or via a script.


  2. You must have "Nearby local lights" turned on in the Graphics Detail section of your preferences.


  3. Your Nighttime Brightness setting (Adv. Graphics tab) must be sufficiently low so that local the global ambient light is less intense than the local light. If the nighttime brightness is too high, it can be difficult to see much effect from local lights.


Also, remember that only the nearest eight lights at any given time will be rendered, so to see the effect of any particular light, make sure that no other eight lights are closer to your avatar than the one you're working on. It's generally best to work on a light in an isolated area, free from all other lights.

From: Valradica Vanek
I have read through the wiki and searched all the lighting stuff I could find, but it still doesn't work. below is the DoLight fragment of my code. I assign the values of the variables elsewhere. The lights turn on and off, but I am having a problem getting the difference between a "light source" (that illuminates the area around the light) and the LightBright parameter for prim surfaces, which just make the prim as bright as possible.

I can't really help you with the specifics of how to fix your script, but I see that there's at least one if not several syntax errors in the script when I try to compile it in SL. That may be just because it's a fragment, and not the full script, of course, but I'm afraid my scripting skills are not good enough to tell.

As Cottonteil said, I'd recommend posting it in the scripting forum. The people who read that forum are guaranteed to be scripters. The people who fequent this forum, not so much.

From: Valradica Vanek
BTW, how does one put code fragments like this into the nice parsed form [IMG]that I see in all the other postings. couldn't figure it out.

The easiest way to figure out how something was done in another post is to press the quote button at the bottom of it. That will show you the exact bbCode syntax that was used.

To answer your question, the best way to post LSL scripts here is to use the PHP Code function. The Lindens have PHP set up here to color everything the same way LSL gets colored on the inworld script editor.

To post PHP, you just need to do two very simple things. Simply type [/php] at the end of the script, and
CODE
at the beginning (or just use the php button at the top of the text entry form; it does the same thing). Anything inbetween those two tags will appear as code.

Oh, and in case you're wondering, the reason I put the end first and the beginning second in the instructions there was just to keep the system from thinking I was actually trying to post code myself. I hope that isn't confusing at all. Remember the one without the slash is the one to start with. Formatting tags in bbCode always start with a command in square brackets and end with a slash-command in square brackets.
_____________________
.

Land now available for rent in Indigo. Low rates. Quiet, low-lag mainland sim with good neighbors. IM me in-world if you're interested.