Jump to content

Fade prim to transparent for a few seconds


Elias Gearhead
 Share

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

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

Recommended Posts

Hi,

I'm new to LSL though not coding.

I'm trying figure out how  to fade a prim for say 5 seconds, and then reappear for 0.5 seconds, and then loop.

I realise there a number of ways to do it:

a) Set the default state to be 100% transparency and then reduce transparency to 0% for 0.5 seconds, and set the whole thing on a 5 second loop.tex

b) Do the opposite, set default state to 0% transparency and then increase transparency to 100% for 5 seconds, on a 0.5 second loop.

c) Do something with textures; i.e. have two textures, one blank and one default texture, and do the whole 5 second, 0.5 second texture switch loop. Problem with this one is that unlike with transparency, alpha textures can sometimes leave that alpha 'halo' effect you can sometimes see in hair.

 

I tried to use a very basic llSetAlpha script generated online, but it doesn't work. I'd rather work with transparency instead if someone is willing to give me a hand.

Thank you!

 

Link to comment
Share on other sites

There seems to be some kind of disconnect somewhere, "alpha" and "transparency" are the exact same thing regardless of context.

  1. llSetAlpha changes the transparency of an object's face.
  2. Textures with an alpha channel can be partially transparent.
  3. Textures without an alpha channel (or alpha blending) can't be transparent.

You have the basic concept correct though. (Except you can't switch between two textures over a period of time, it has to happen instantly.) You need to start from one end and just use llSetAlpha to adjust the object in small increments. You can either do it in a single loop with llSleep to control how long the loop takes to complete, or you can use llSetTimerEvent so that the alpha change is done in a non-blocking way which allows your script to do other things in between the alpha changes.

The wiki page actually has an example that's pretty close to what you're trying to do.

Edited by Wulfie Reanimator
Link to comment
Share on other sites

One other possibility is texture animation, make up a 512 by 512 texture divided into 16 frames, each frame has progressively more alpha, then use the smooth parameter. This will only work if you don't need a lot of fine detail, of course, but it's a good way of faking something like cobwebs fluttering or ghostly haze.

  • Like 1
Link to comment
Share on other sites

1 hour ago, Profaitchikenz Haiku said:

One other possibility is texture animation, make up a 512 by 512 texture divided into 16 frames, each frame has progressively more alpha, then use the smooth parameter. This will only work if you don't need a lot of fine detail, of course, but it's a good way of faking something like cobwebs fluttering or ghostly haze.

It would help to know if the surface is uniform or has a complex texture. If the latter, the minimum resolution of that texture determines whether texture animation is even an option. Either way, though, I think this calls for cel-based (frame-by-frame) texture animation here, rather than SMOOTH. If the surface is already textured it's a question whether it's even practical to get enough frames to fade gradually, with enough detail in a single animated texture.

The reason it's worth pursuing the texture animation approach is that it's "set and forget" -- the script doesn't need to keep running or even stay in the object once the texture animation gets set as a prim property. That's in contrast to adjusting transparency in a loop, where the tightness of the loop determines the smoothness of the fading effect.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 1695 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...