Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llSetAlpha Flickering

PleaseWakeMeUp Idler
Registered User
Join date: 10 Oct 2006
Posts: 48
11-19-2007 08:20
I'm having a problem with a script I just wrote. It works but the texture flickers. All I want to do fade an image in and out, but the flicker is makes it useless.

What can I do to change this to eliminate the flicker. (Note, I'm a novice LSL programmer but I have significant RL programming experience, so I can probably understand what you have to say...)

Thanks!

Wake

-------------------

float alpha = 0.5;
float distance = 0.25;
float direction = 1.0;
float step = 0.01;
float stepSource = 0.01;
float maxDistance = 0.80;

newDirStep()
{
if (step > 0) {
step = -1 * stepSource;
}else {
step = 1 * stepSource;
}
distance = llFrand(maxDistance);
//llSay (0, "newDirStep: " + (string)distance);
}

default
{

state_entry()
{
llSetTimerEvent(1);
}



timer()
{
if (distance > 0) {
alpha += step;
distance -= stepSource;
//llSay(0, "distance > 0, alpha is: " + (string) alpha + " distance is: " + (string)distance);
} else {
//llSay(0, "distance < 0, alpha is: " + (string) alpha + " distance is: " + (string)distance);
newDirStep();
}
if (alpha < 0) {
alpha = 0;
//llSay (0, "alpha < 0";);
newDirStep();
} else if (alpha > 1.0) {
alpha = 1.0;
//llSay (0, "alpha > 0";);
newDirStep();

}
llSetAlpha(alpha, ALL_SIDES);
}

}
_____________________
Please visit http://www.SecondSeeker.com for reviews of "non-sleaze" SL sites.
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
11-19-2007 11:48
I think I understand your script, and I think it looks OK :) What exactly do you mean by "the texture flickers"? Is it blinking on and off? Does the alpha jump to 0, or jump to 1, when it shouldn't? Could you be getting texture issues because your prim might be intersecting with another prim?
Haruki Watanabe
llSLCrash(void);
Join date: 28 Mar 2007
Posts: 434
11-19-2007 12:36
I tested your script inworld and saw the «flicker» :)

I played around with the settings a little and found out, that in- and decreasing the alpha-value by 0.01 could be the problem. If you choose a value of 0.1, the flicker is (mostly) gone. The transition is not as smooth anymore, but it still looks ok.

I'd try to adjust the alpha-value until the flicker is not visible anymore and the transition looks ok for you...
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
11-19-2007 20:29
I had a similar problem using SetAlpha on hidden sides to force viewer updates... (using a transition from full to zero alpha) .. and would sometimes show fullbright

I eliminated the need, but if .1 changes work better it may be useful for other projects, thanks Haruki =)
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Squirrel Wood
Nuteater. Beware!
Join date: 14 Jun 2006
Posts: 471
11-20-2007 00:18
I have noticed the bad practice of using channel 0 says to output debug messages in your script.

I would advise you to make use of llOwnerSay() instead to not spam other players with such messages.
PleaseWakeMeUp Idler
Registered User
Join date: 10 Oct 2006
Posts: 48
11-20-2007 06:02
hmmm, seting the jump to 0.1 is not a good workaround, I'm looking for a smooth fade, not steps.

The flicker is not the prim intersecting flicker, it is a flash that occurs everytime the alpha channel is set. But curiosuly, sometimes I do NOT see this flash. I think this may be environmental, in my sky-sandbox it works just fine, on the ground, it flashes once in awhile.

And I didn't know about the OwnerSay call, I'll do that next time I need debuging. This is my first script, I don't know much about it.

Wake
_____________________
Please visit http://www.SecondSeeker.com for reviews of "non-sleaze" SL sites.
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
11-20-2007 06:30
as with mine, the flash/flicker/fullbirght-look was happening ~ 1 in 50 times... I wonder if occasionally the sim isn't being caught in the middle of the update when it's getting a new change and something is happening there.... or possibly something to do with misordered or mangled packets to the viewer, or bad handling of them by the viewer.

in your case, perhaps upping the amount a little would cut down on how many continuous updates it made, thus preventing the problem in MOST cases.... 5% transparency changes shouldn't be that noticeable or perhaps just 4%
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -