Page 1 of 1

Gadget Request: Fade to Clear

Posted: 11 Nov 2007, 19:35
by Argh
Heyas... I'd like a Gadget that could be invoked via COB that would cause all of a Unit's surfaces to alpha fade to clear (i.e., gradually disappear). I'm going to use it for certain units in PURE, where I want them to die, do a death animation, and then fade away, instead of leaving a Corpse.

Any help on this would be great.

Posted: 11 Nov 2007, 19:41
by rattle
#define ALPHA_THRESHOLD 103 // set or get
KDR added it.

Posted: 11 Nov 2007, 19:41
by tombom

Posted: 11 Nov 2007, 19:53
by Argh
Oh! Sweet! I'll have to try that out tonight!

Posted: 11 Nov 2007, 20:06
by KDR_11k
ALPHA_THRESHOLD does not fade, it "disintegrates", look at the KP Div Zero build anims for an example. Proper fading needs alpha blending and manual Z-sorting unless you do it the console way and just use additive blending.

Posted: 12 Nov 2007, 04:54
by Argh
Yeah, this doesn't really do what I needed, since it's strictly ON/OFF, it looks pretty terrible with stuff in PURE. Oh well.

Posted: 19 Nov 2007, 03:00
by Argh
So, since this isn't strictly possible within COB, anybody got an idea of how I can do this with LUA? I'd think it's pretty easily done... I've been looking at the code for the transform stuff in CA, and that looks like it might be a good starting place...

Posted: 19 Nov 2007, 03:03
by Peet
Well my Simbase sdd uses ALPHA_THRESHOLD to achieve fading fairly well for the commander, if you want to avoid going through the whole deal of lua rendering

Posted: 19 Nov 2007, 03:23
by trepan
s/deal/ordeal ;-)

Argh: you'd have to use LuaRules to call Spring.SetUnitNoDraw(), and
then draw the unit yourself with the alpha level you want. Drawing it
yourself with the alpha might take a little work depending on what the
engine calls do (you might need to do it "raw draw" style, using your own
setup).

Posted: 19 Nov 2007, 03:39
by Argh
I think it might be worth doing the hard way- I've also been wanting to do something with drawing units being built, but I should probably make a screen of what I'd like, first...

Posted: 19 Nov 2007, 17:55
by AF
rendering the unit as is in a block colour and fading it out shouldn't be that hard, although I'm not sure how lua exposes the models vertexes.

Posted: 20 Nov 2007, 13:53
by KDR_11k
I implemented my own build anim that used Lua to draw the unit additive, was fairly easy.