pulsing glow...
|
|
jamieparsons Lemon
undergrad n00b
Join date: 5 Nov 2008
Posts: 36
|
11-20-2008 05:41
I'm trying to get one of my prims to glow, well I've managed it but the script seems an awful mess...
I've used a combination of llsleep and llsetprimitiveparams repeated so the glow slowly becomes brighter then back down, seems an awful lot to do for a pulse.
Would a while loop work ? I have a variable that increments until the loop finishes then goes to another till the glow is gone then the variable resets then it all starts over... any suggestions?
|
|
Dora Gustafson
Registered User
Join date: 13 Mar 2007
Posts: 779
|
11-20-2008 05:58
I guess I would use an animated texture getting brighter and darker together with the glow. That way you can start it with a script and then remove the script, the prim will continue to glow up and down 
_____________________
From Studio Dora
|
|
jamieparsons Lemon
undergrad n00b
Join date: 5 Nov 2008
Posts: 36
|
11-20-2008 07:06
Hmm good idea dora cheers  just need something that is going to work just now though but I'll looked into animated textures.
|
|
Wouter Hobble
Registered User
Join date: 25 Mar 2008
Posts: 21
|
11-20-2008 07:13
Well texture animations are actually not that hard. You just make a texture with the shades you want to go through stitched together at a set distance and then loop through or ping-pong in your case maybe: http://wiki.secondlife.com/wiki/LlSetTextureAnim
|
|
jamieparsons Lemon
undergrad n00b
Join date: 5 Nov 2008
Posts: 36
|
11-20-2008 07:22
My only problem with the animated textures is that it will not give the glow that I am looking for, it will just ping pong between 2 shades of my chosen colour. Or am I being a n00b? :/
|
|
Wouter Hobble
Registered User
Join date: 25 Mar 2008
Posts: 21
|
11-20-2008 07:33
No you are right, perhaps you can use something like:
integer level = 1; while (level) { // set the glow based on what level is llWait(1.0); level++; if (level > 9) level =1; if (gLoopOff) {level=0; gLoopOff = FALSE;} }
Then you can set the gLoopOff globally and use that to turn it on and off (although I never really checked if this would lock the script for other events while running).
Sorry for not taking more time to read the original question.
|
|
Dora Gustafson
Registered User
Join date: 13 Mar 2007
Posts: 779
|
11-20-2008 09:54
From: jamieparsons Lemon My only problem with the animated textures is that it will not give the glow that I am looking for, it will just ping pong between 2 shades of my chosen colour. Or am I being a n00b? :/ The reason I came up with my solution is the way glow behaves: it looks stronger with a brighter color than with a darker. Glow from a black surface will not be noticed no matter how strong you make it  And why are you saying two shades? You can make many more shades with an animated texture if you make the texture right and if you choose proper parameters for llSetTextureAnim
_____________________
From Studio Dora
|
|
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
|
11-21-2008 00:25
I agree with Dora about the problems of using glow with a darker colour, but if you want to make it pulsate on a lighter coloured prim, this is how I did it recently. Hope this helps. integer on = TRUE; float x = 0; float y = 0.25; // max value for glow ... anything over 0.3 is a bit bright for most purposes float t = 0.2; // to control how fast it fades up and down
default { on_rez (integer p) { llResetScript(); } state_entry() { llSetTimerEvent(0.0); llSetPrimitiveParams([PRIM_GLOW, ALL_SIDES, 0.0]); } touch_start(integer total_number) { state running; } }
state running
{ state_entry() { llSetTimerEvent(1.0); // needed so you can get the touch_start to interupt the timer and turn it off! }
timer() { if (on == TRUE) { for (x = 0; x < y; x+=0.01) { llSetPrimitiveParams([PRIM_GLOW, ALL_SIDES, x]); llSleep(t); } on = FALSE; } else if (on == FALSE) { for (x = y; x >0.0; x-=0.01) { llSetPrimitiveParams([PRIM_GLOW, ALL_SIDES, x]); llSleep(t); } on = TRUE; } } touch_start(integer total_number) { state default; } }
|
|
jamieparsons Lemon
undergrad n00b
Join date: 5 Nov 2008
Posts: 36
|
11-21-2008 03:07
well cheers for your help folks but I took a n00b approach at doing it... default { state_entry() {
llSetPrimitiveParams([PRIM_GLOW, ALL_SIDES, 0.3]); llSetPrimitiveParams([PRIM_GLOW, ALL_SIDES, 0.5]); llSetPrimitiveParams([PRIM_GLOW, ALL_SIDES, 0.7]); llSetPrimitiveParams([PRIM_GLOW, ALL_SIDES, 1.0]); llSetPrimitiveParams([PRIM_GLOW, ALL_SIDES, 0.9]); llSetPrimitiveParams([PRIM_GLOW, ALL_SIDES, 0.8]); llSetPrimitiveParams([PRIM_GLOW, ALL_SIDES, 0.7]); llSetPrimitiveParams([PRIM_GLOW, ALL_SIDES, 0.6]); llSetPrimitiveParams([PRIM_GLOW, ALL_SIDES, 0.5]); llSetPrimitiveParams([PRIM_GLOW, ALL_SIDES, 0.4]); llSetPrimitiveParams([PRIM_GLOW, ALL_SIDES, 0.3]); llSetPrimitiveParams([PRIM_GLOW, ALL_SIDES, 0.2]);
llResetScript(); } }
I'm using it as a heartbeat ya see so being on constantly is totally fine for me. I'll have a wee look at the posted codes above though, I know multiple lists like this will be horrible for processing... but it works :)
|
|
Dora Gustafson
Registered User
Join date: 13 Mar 2007
Posts: 779
|
11-21-2008 04:22
From: jamieparsons Lemon well cheers for your help folks but I took a n00b approach at doing it... default { state_entry() { llSetPrimitiveParams([PRIM_GLOW, ALL_SIDES, 0.3]); llSetPrimitiveParams([PRIM_GLOW, ALL_SIDES, 0.5]); llSetPrimitiveParams([PRIM_GLOW, ALL_SIDES, 0.7]); llSetPrimitiveParams([PRIM_GLOW, ALL_SIDES, 1.0]); llSetPrimitiveParams([PRIM_GLOW, ALL_SIDES, 0.9]); llSetPrimitiveParams([PRIM_GLOW, ALL_SIDES, 0.8]); llSetPrimitiveParams([PRIM_GLOW, ALL_SIDES, 0.7]); llSetPrimitiveParams([PRIM_GLOW, ALL_SIDES, 0.6]); llSetPrimitiveParams([PRIM_GLOW, ALL_SIDES, 0.5]); llSetPrimitiveParams([PRIM_GLOW, ALL_SIDES, 0.4]); llSetPrimitiveParams([PRIM_GLOW, ALL_SIDES, 0.3]); llSetPrimitiveParams([PRIM_GLOW, ALL_SIDES, 0.2]); llResetScript(); } }
I'm using it as a heartbeat ya see so being on constantly is totally fine for me. I'll have a wee look at the posted codes above though, I know multiple lists like this will be horrible for processing... but it works :)
If you are happy with this you just do it this way. It makes my old scripter heart bleed  1. You have no timing control at all! it is all up to system execution times how fast the glow will pulse. 2. The pulsing will be erratic, not smooth in places with lag 3. You put a constant load on sim, internet and all involved viewers i.e. creating lag Never mind, the script can serve as an experiment 
_____________________
From Studio Dora
|
|
Quite Oh
Registered User
Join date: 29 Jun 2008
Posts: 2
|
11-30-2008 13:54
From: jamieparsons Lemon I'm trying to get one of my prims to glow, well I've managed it but the script seems an awful mess...
I've used a combination of llsleep and llsetprimitiveparams repeated so the glow slowly becomes brighter then back down, seems an awful lot to do for a pulse.
Would a while loop work ? I have a variable that increments until the loop finishes then goes to another till the glow is gone then the variable resets then it all starts over... any suggestions? Hey! I just solved that problem a couple days ago. Full code is here: http://quiteoh.wordpress.com/quite-ohs-lsl-snippets/[Later: Best just to post it here.] Pulsing a glow effect // Glow parameters float gGlow = 0.10; float gGlowTop = 0.50; float gGlowBottom = 0.05; float gGlowIncrement = 0.05; // Pulse parameters 0 for decrement, 1 for increment integer gPulseDirection = 0; integer gPulseSpeed = .01; default { touch_start(integer total_number) { llSetTimerEvent(gPulseSpeed); } // Pulse the glow timer() { // Glow: increment up, and down (like it's pulsing) if (gGlow >= gGlowTop) { gPulseDirection = 0; } if (gGlow <= gGlowBottom) { gPulseDirection = 1; } if ( gPulseDirection ) { gGlow += gGlowIncrement; } else { gGlow -= gGlowIncrement; } llSetPrimitiveParams([PRIM_GLOW, ALL_SIDES, gGlow]); } }
|
|
Adger Ragu
Use the forge, Luke.
Join date: 14 Oct 2008
Posts: 25
|
01-27-2009 12:20
From: Quite Oh Hey! I just solved that problem a couple days ago. Full code is here: (...) integer gPulseSpeed = .01; (...) that won't work.
|
|
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
|
01-27-2009 12:32
Doing it with a brighter or dimmer animated texture and a constant glow multiplier will make something that looks like it's a constant color with a pulsing glow, and be all handled at client side.
Try it with a gradient from <255,0,0> to <63,0,0>, a pingpong texture animation with a scale of 0.001, and a glow of 0.4.
|
|
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
|
01-27-2009 17:55
 i may have to use my tax return to get a new graphics card. glow isn't an option for me unless someone can tell me how to fix it. maybe there's some settings in my computer i need to change? current;y i have a RADEON 9250, got it cheap at a discount electronics store when sl changed the graphics and i was one of many that saw flickering squares of textures instead of the avatar imposters
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
01-27-2009 21:51
The only problem with constant glow and cycling color is that if anything light colored with even a tiny bit of transparency is placed in front of the surface, it'll remain lit up like a Christmas tree. But if that's not an issue for you, an animated texture is a great idea. Much smoother and much easier on lag as stated above.
|