Jump to content

Automatic lighting


Lewis Nerd
 Share

You are about to reply to a thread that has been inactive for 195 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

I would like to set up a way that lights on my land will come on when it gets dark.  The actual scripting itself I can do but I'm having trouble "reading" the time of day.

Now, I know that the light cycle during the day can be read with llGetSunDirection and llGetEnvironment but this is based on the region's default settings and the four hour day/night cycle whereas I'd like to be able to read the sun position based on the client's settings, so if I set sunset or night using CTRL-SHIFT-N or CTRL-SHIFT-Z in my SL viewer (which moves the sun and provides the appropriate sky position based on what the user has chosen in "Environment") I get no change using either of the basic starter scripts shown in the listed wiki pages, the response being based on server time rather than my local settings.

Is there any way to automatically read the 'environment' rather than the region clock, so I can set the lights to come on or go off as appropriately rather than it to respond to the system clock?

I'm not much of a scripter so am at a bit of a loss as to what I need to 'read' to get the local environment settings for the sun/moon position, rather than the server time - if, in fact it's possible at all and I need to think of another way to achieve it.

I can set up something via chat so I can use a voice command to turn on or off all the lights - but of course that relies on me being in-world whereas I'd like my lights (both streetlights and inside buildings) to be able to be set to come on or off based on whether it's dark or not for any visitors at any time, a bit like timer based lights or Alexa routines in first life.

Any pointers gratefully recieved.

Edited by Lewis Nerd
Link to comment
Share on other sites

From what I understand, a viewer's environment settings are purely local and can not be read by the server. At best, the server can override a target agent's environment via script (or parcel entry), but there is no guarantee those settings will be honored and/or won't be changed locally at any given moment. The viewer does not communicate such changes back to the server.

Also, llGetSunDirection returns the parcel's env setting if a custom one is defined - otherwise it returns the region's setting. So you could configure your parcel to use a custom env and then script your lights to follow that.

Edited by Fenix Eldritch
Link to comment
Share on other sites

I had a feeling that "it can't be done".  There's plenty of 'automatic lights' on the marketplace but I'm guessing that they are based on the server side function and region time, not the local client setting.  Obviously the client 'moves the sun' and responds with darkness as appropriate but I guess LSL doesn't detect that?

I'd have thought "lights that come on automatically when it's dark" would have been a very popular thing but I guess I'm the only one that's thought of it.

Does any LSL read the client side settings rather than the server side?  As I said the idea was simply that lights automatically switch on or off when required, based on the local setting.  Of course, I can just leave all the lights on all the time but I'm a bit concerned about my virtual electricity bill... plus, of course, some things don't look right with lighting on during the day.

Setting the lights to follow the server setting would work fine if people leave the environment alone, but sometimes I like to 'force midday' if I'm working on building something I don't want to struggle to see if the sun goes down, and sometimes I like to 'force midnight' as things can look very different at night.  I guess I just hoped that something reading the sun position was based on client side not server side.

Link to comment
Share on other sites

49 minutes ago, Lewis Nerd said:

Does any LSL read the client side settings rather than the server side?

No not really. Everything in SL is intended to look the same for all observers, to conform to a "shared experience" as a very intentional choice by the devs. While a few things break that, like local environment settings, and sometimes media-on-a-prim, there's no way to change object properties for individual observers. Either the light is on or it isn't, who's local settings should get to decide that, the nearest person?

Edited by Quistess Alpha
  • Like 1
Link to comment
Share on other sites

14 minutes ago, Quistess Alpha said:

Either the light is on or it isn't, who's local settings should get to decide that, the nearest person?

That was kinda my point, that I wanted it to be responsive to the local settings rather than the global settings, so if there's two visitors on my land, one using system settings (daytime) the lights are off for that user, and if the other user has intentionally set night time then the lights come on for them.

I can understand the point of 'shared experiences' but not everything needs to be?  My SL experience tends to be very solo, partly because most of the people I used to be online with are no longer in-world, and I very rarely venture outside of my own land as for me it's more of a personal sandbox rather than 'another social media channel' - for various reasons over the years that I've been here that I won't bore you with.

I guess I was just hoping that there was a way to detect what the client side sun/moon position was, rather than server side, because you can change the time of day for yourself and the client renders the lights appropriately; as you say there is the 'shared experience' aspect but not when the function exists to change the environment for yourself only (notwithstanding the 'forced parcel environment' such as fog or some other specific time of day that you can choose.

I've not really looked much at the 'environment' settings as it wasn't something that particularly interested me when it came out, and I assume that there's no way to read the environment settings to detect whether a user has chosen 'night'?

Although I have been in SL a long time, LSL is always something that has eluded me for proficiency.  Sorry.

  • Like 1
Link to comment
Share on other sites

It's true there's no mechanism for the server to tell what environment settings have been applied viewer-side, but a user could change how they set their agent-specific environment so as to clue-in the region about it, using a script instead of the viewer built-in UI for "secretly" overriding the parcel's local settings. (That script would call llSetAgentEnvironment to tweak the individual's settings. Then, if the parcel contained other scripts—lamps, etc—that wanted to respond to this specific agent's settings it would at least be possible.

Now, if it were me, I'd only care about one particular user's private settings: the landowner themself. And I'd broadcast those settings parcel-wide by updating an Experience Key-Value Pair persistent store that all the scripted lamps could read for updates when triggered by llRegionSay() on some obscure channel.

I don't know if any such scripts exist off-the-shelf; the market seems pretty limited. For one thing, if a landowner wanted their environment settings to affect the parcel, they could just set the parcel's environment using much the same functionality used to set their private environment.

The more common use of llSet- or llReplaceAgentEnvironment() is for a parcel-resident script to supply a new environment to Experience-participating visitors, either to give them a dynamic environmental effect (which I highly recommend),  lighting specific to their presence in a room or cave or other setting within the parcel, or a temporary lighting effect "caused" by something they did. Having one's own private lighting,  unknown to the region, completely defeats those immersive uses. I wish people wouldn't use that viewer-side environment feature at all, except for momentary photography.

Edited by Qie Niangao
  • Like 1
Link to comment
Share on other sites

Lighting is about to get more serious. as PBR finally kicks in. There are some gimmicks, though, so every space unlit doesn't go pitch-black by default. That's the way PBR is supposed to work, but from last week's creator user group, it seems like that won't turn on until you add at least one reflection probe.

Please, though, light your public spaces. I'm in a newly built region right now, and about half the stores have lighting, and half are dark. If you have a place open to the public, visit it with your viewer set to midnight and shadows on.

  • Thanks 1
Link to comment
Share on other sites

7 hours ago, Love Zhaoying said:

The "normal" approach if you have some special parcel settings (lights, etc.) is to message everyone upon entering your parcel/region: "For the best effect, set your environment to Night/System time/etc."

That's kinda the opposite of what I was seeking to achieve.  I wanted the lights to come on if it was dark for the user, rather than having a 'special parcel setting'.  My build isn't designed for night only, it's designed for any time, but I just didn't want to have all the lights on all the time.  I know some areas are 'forced dark' but I guess I just wanted the lights to react like real world lights and come on if it's dark (I know you can't just 'turn on the dark' in real life, but you know what I mean...)

Link to comment
Share on other sites

2 hours ago, animats said:

Lighting is about to get more serious. as PBR finally kicks in. There are some gimmicks, though, so every space unlit doesn't go pitch-black by default. That's the way PBR is supposed to work, but from last week's creator user group, it seems like that won't turn on until you add at least one reflection probe.

I wasn't aware of PBR until I looked it up after you mentioned it.  I guess we'll have to see whether that provides a solution to my problem or not.

2 hours ago, animats said:

Please, though, light your public spaces. I'm in a newly built region right now, and about half the stores have lighting, and half are dark. If you have a place open to the public, visit it with your viewer set to midnight and shadows on.

Having 'lights permanently on' seems to cause some issues with textures washing out in some places during daylight but with tweaking I guess I can make it work and not look too bad.

I've always had 'land open to the public' - although I don't get very many visitors and I build mainly for my own pleasure, I've never understood the existence of 'ban lines' and security orbs; it's not as if you can physically steal anything from anyone's builds... and if you want to do things you don't want the public to see, that's why skyboxes were invented for.

Link to comment
Share on other sites

2 hours ago, Lewis Nerd said:

That's kinda the opposite of what I was seeking to achieve.  I wanted the lights to come on if it was dark for the user, rather than having a 'special parcel setting'.  My build isn't designed for night only, it's designed for any time, but I just didn't want to have all the lights on all the time.  I know some areas are 'forced dark' but I guess I just wanted the lights to react like real world lights and come on if it's dark (I know you can't just 'turn on the dark' in real life, but you know what I mean...)

Yes, I know.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 195 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...