Jump to content

Wanted - Light On/Off Script for Single Face Lit Obejct


oliviatoms
 Share

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

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

Recommended Posts

I've looked through everything I can think of and can't find a script that turns a light on and off, using a separate switch, that lights only a single face of an object, such Face 0. All of them I've seen light the entire object and don't give you as much lighting control as I'd like. Lighting the entire object can make fior some brutal lighting at times and I want something more subtle.

 

Thanks in advance for any help given to this search of mine. :)

Link to comment
Share on other sites

Lighting is a prim function, you're not able to apply it to one face only.

However, playing around with the light options on the features tab, eg range, intensity, fall-off can achieve more subtle effects.

I found that lighting from an object can be a bit hard on the avatar from certain angles and placing an invisible prim as the light source at a more suitable spot can make for a more pleasing effect.

The other non-light options that make a prim appear "lit" such as glow and brightness may give the illusion of the light coming from the part of the build that you want to indicate as the light "source".

Hope this helps.

 

Emma :)

Link to comment
Share on other sites

Actually, you CAN apply it to one face only. I've done it many a time and currently have lights on one face only throughout my house. :) It makes the light directional and MUCH more sublte and controllable. There's instructional videos that show you how to do it if you're interested.

 

The problem is I can't control it remotely so it will turn on and off with a script and just be lit on one face, allowing me to control it the way I want.

Link to comment
Share on other sites

You are actually talking about a projector. It's not really one face lit, just the light focussed out one side. Only 1 light per prim, but you could use multiples. I link in single plane meshes to keep LI down.

 

Sadly LSL doesn't have functions to control them, but they are retained if you set them manually.

 

// Public domain code. Do with it what you will.// Change these *only* if you don't set the light up in world...// Setting up the light in world is far easier for most people.// If you do change it in world, reset this script to re-read the parameters.//float falloff = 0.75;float intensity = 1.0;float radius = 10.0;vector color = <1,1,1>;integer manual = 0;             // set to 1 to use your manual parameters or leave as 0 to get them from the prim// === don't change below here ===integer OFF = 0;integer ON = 1;default{    state_entry()    {        if  (!manual) {            list initial = llGetLinkPrimitiveParams(LINK_THIS, [PRIM_POINT_LIGHT]);                        color = llList2Vector(initial,1);            intensity = llList2Float(initial,2);            radius = llList2Float(initial,3);            falloff = llList2Float(initial,4);        }        state on;            }}state on{    state_entry()    {        llSetLinkPrimitiveParamsFast(LINK_SET,                [ PRIM_POINT_LIGHT, ON, color, intensity, radius, falloff ]);    }        touch_start(integer num_detected)    {        state off;    }}state off{    state_entry()    {        llSetLinkPrimitiveParamsFast(LINK_SET,                [ PRIM_POINT_LIGHT, OFF, color, intensity, radius, falloff ]);    }        touch_start(integer num_detected)    {        state on;    }}

Use: Set your prim up with the lighting just how you like it. Use projector textures to focus the light to specific places. Then reset this script to read your settings. From there, touch on/off.

 

You can skip the read of your settings and force them if you prefer, but I find it easier to construct my lighting as I go.

 

Link to comment
Share on other sites


Emma Krokus wrote:

@ pleasure boi: what are projecture textures please?

Something like 



You edit the object, go to the properties tab (The third one where you normally turn on light) and you drop a texture like that on the second box (which you can only see if you have ALS on)

then play with the focus settings to get a nice soft effect that is projected - like a slide projector - oout of the prim from one face.

Link to comment
Share on other sites

  • 2 months later...

Daeberethwen Arbenlow made a somewhat more complete and still very clear tutorial here:

. Daeberethwen is great to explain things, she has many other interesting tutorials.

 

Projected lights and images are a very interesting feature: cast shadows, colored shadows, club lightings.... but also unexpected effects with shiny surfaces like mirrors:

"

 

When I read the PRIM_POINT_LIGHT LSL wiki page, I was disappointed to see, in  caveats, that "There are no LSL functions that allow you to set projector values (texture, FOV, focus, and ambiance)" .  I found there too that this  lack has been reported several times in JIRA, but with no answer, no assignment... :-(

I suppose that many critical or complex issues and goals grabbed the attention of SL developers, but improving this tiny aspect would open the door to many nice and funny applications with "little" effort as the features already exist and are stable, only LSL interface misses.

finally on the same PRIM_POINT_LIGHT wiki page you can find this tiny on/ off script that I use in all my lights and projectors:

integer switch;default{    touch_start(integer total_number)    {        llSetPrimitiveParams(        [       PRIM_FULLBRIGHT, ALL_SIDES, switch = !switch,                PRIM_POINT_LIGHT, switch, <1, 0.5, 0.1> *  switch, 1, 10, 0.6 ] );          }}

The PRIM_FULLBRIGHT lits the face you want ( replace ALL_SIDES by the face number) while  PRIM_POINT_LIGHT controls the ambient light (and projection in a binary way). The script is less beautiful than pleasureboi's one but when you get familiar with it  is  useful as well.

 It is possible to control both PRIM_FULLBRIGHT and PRIM_POINT_LIGHT remotely but I am not tough enough in LSL at the moment to give you a clear example. I can just say that you need a talker script in the command and a listener one in the target ( the light) and, of course a talking channel. I got some clear information and usefful examples at

The Particles Lab (http://maps.secondlife.com/secondlife/Teal/204/49/301)

You may find  exactly what you want here.

Link to comment
Share on other sites

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

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...