Gadget Request: Fade to Clear

Gadget Request: Fade to Clear

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Post Reply
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Gadget Request: Fade to Clear

Post 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.
User avatar
rattle
Damned Developer
Posts: 8278
Joined: 01 Jun 2006, 13:15

Post by rattle »

#define ALPHA_THRESHOLD 103 // set or get
KDR added it.
tombom
Posts: 1933
Joined: 18 Dec 2005, 20:21

Post by tombom »

User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

Oh! Sweet! I'll have to try that out tonight!
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post 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.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post 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.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post 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...
User avatar
Peet
Malcontent
Posts: 4384
Joined: 27 Feb 2006, 22:04

Post 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
trepan
Former Engine Dev
Posts: 1200
Joined: 17 Nov 2005, 00:52

Post 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).
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post 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...
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post 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.
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post by KDR_11k »

I implemented my own build anim that used Lua to draw the unit additive, was fairly easy.
Post Reply

Return to “Lua Scripts”