Lights and lighting
|
Charlton Pendragon
Senior Member
Join date: 7 Jan 2004
Posts: 85
|
04-29-2004 03:44
I have read, and learnt, much about how to reduce lag in sims and such, and remember that some comments were about lights. I have a build that needs some internal lighting and would appreciate some advice as to the best approach - please! I have seen some lights that come on only when it is dark, and I have seen others that you can switch on/off (I have scripts to enable the latter, but not the former). My questions are: * does the light prim always need to be set to 'light' material rather than, say, 'wood? Logic would suggest yes. * are particle lights better? Part of me thinks that having lights that only come on when someone actually comes into the build would be more efficient...has this been done? Please - any advice would be welcome! Thanks 
_____________________
Noyo Moorings & Tower / Rua Island
|
Julian Fate
80's Pop Star
Join date: 19 Oct 2003
Posts: 1,020
|
04-29-2004 08:40
Only prims set to the "light" material will cast light, and then only if you have Local Lighting turned on in your display settings.
Particles can be made to show up in the dark but they don't cast any light.
Lights have been made that adjust to time of day or the presence and absence of people. Check the scripting forums for more.
|
Lumiere Noir
Ivory Tower Dweller
Join date: 25 Dec 2003
Posts: 212
|
Re: Lights and lighting
04-29-2004 08:57
From: someone Originally posted by Charlton Pendragon I have seen some lights that come on only when it is dark, and I have seen others that you can switch on/off (I have scripts to enable the latter, but not the former). My questions are:
* does the light prim always need to be set to 'light' material rather than, say, 'wood? Logic would suggest yes.
* are particle lights better?
Part of me thinks that having lights that only come on when someone actually comes into the build would be more efficient...has this been done?
Please - any advice would be welcome!
Thanks Charlton, I have lights on the outside of my Ivory Tower Library that only come on at night, and this is mostly to attract visitors and to illuminate the tower's landing pier. I'm not yet sophisticated enough to have lights come on by sensor on the inside of the building (and many of my exhibits use the light effect day and night to simulate the Second Life building interface. While particle lights actually look like real light sources, they don't cast any illumination like a light object does. I have a feeling that particle lights, even if you're just using 'drop' take up more processing power than a normal lighted prim would. I'm not positive about this but it seems likely. If you'd like my 'become a light only at night script,' please let me know. Lumi
_____________________
Want to learn to build? Visit the Ivory Tower Library of Primitives at Natoma (205, 170)
Have an Edifice Complex? Join the building group Edifice Rex, IM me by name!
PrimWiki! http://ivorytowerlibrary.com/primwiki Ivory Tower Forums http://ivorytowerlibrary.com/forums Natoma Picayune http://ivorytowerlibrary.com
|
Charlton Pendragon
Senior Member
Join date: 7 Jan 2004
Posts: 85
|
04-30-2004 09:23
Thanks for help - I should have checked the script library before I started the thread  There I found Chromal Brodsky's light scripts and am using the 'off/on according to time of day' script on all my light objects. However, I have yet to find a script that turns on light only when avatars are within a given range at night (Chromal does have one that lights only when the light owner is online though). Would that be easy to code? Charlton
_____________________
Noyo Moorings & Tower / Rua Island
|
Moleculor Satyr
Fireflies!
Join date: 5 Jan 2004
Posts: 2,650
|
04-30-2004 11:02
Easy to code? Hell yeah.
Depends on how you want to do it. If you want, you can tie the detection script into the floor of the building, so that whenever someone is standing inside on the floor, the lights are on (collision_start and collision_end sending messages to turn the light on and off), or you could have an llSensorRepeat every... thirty seconds? Minute? For AGENT within X radius.
_____________________
</sarcasm>
|
Julian Fate
80's Pop Star
Join date: 19 Oct 2003
Posts: 1,020
|
04-30-2004 11:24
Just remember that lots of sensor events may be inefficient. You might rather have one sensor object in the middle of your land (depending on the land shape) and a scan radius that covers only your land. It scans every now and then, say every two minutes, and if it detects someone it sends a link message to all the light prims in the building telling them "on". Once it stops detecting people it sends a followup "off" message.
For extra efficiency, have the sensor object check, when it detects someone, whether it has previously told the lights to turn on. If it has then the lights are already on, and it can skip telling them to turn on every two minutes. This means one check in your sensor object instead of a link message detection and material change for every light. Do the opposite when the lights are off and it isn't detecting anyone.
This may not seem like it makes much difference but a sim full of people coding more efficiently adds up. Think globally, act sim-ally. Or something.
|
Phil Metalhead
Game Foundry Leaɗer
Join date: 11 Mar 2003
Posts: 291
|
05-01-2004 00:01
if you want it to be per-floor, use a single repeating sensor (as indicated above) with a long interval (i.e. 30 seconds or longer) and large range (try to cover your whole building). then in the script, use llGetDetectedPos(num) to locate where in your building the player is. a single if/elseif/else structure should be able to parse the coordinates, i.e. vector avpos = llGetDetectedPos(num); if (avpos.z < 10) { // activate lights on first floor } else if (avpos.z < 20) { // activate lights on second floor } else if (avpos.z < 30) { // activate lights on third floor
// keep adding "else if" statements as neeed
} else { // activate lights on the top floor } now mind you, i'm not in-game, so i can't tell you if this will work or not, nor can i make it more detailed (sorry), but this should get you started 
|