Page 1 of 2
Ribbon Effects
Posted: 27 Feb 2008, 23:47
by user
right click to enlarge
right click to enlarge
demo version is almost here.
the unit def values it uses:
Code: Select all
usetrail=<1 or 0>;
used to define the units that will have a trail.
trailr=<number>;trailg=<number>; trailb=<number>;
the trail RGBA color, defaults to white(1,1,1,1).
traila=<number>;
the trail alpha.
trailwidth=<number>;
the width of the trail, required.
trailframes=<number>;
the life time of the trail, defaults to 1.00.
trailblendmode=<0,1,2>;
overlay,additive, or subtractive, defaults to 0.
trailfadealpha=<0 or 1>;
used to determine if its alpha will fade over distance, required.
traildrawinminimap=<0 or 1>;
used to determine if it will be drawn on the minimap too.
traildrawshadow=<0 or 1>;
used to determine if its shadow will be drawn.
traildrawwater=<1 or 0>;
used to determine if it will be drawn on the water reflection and refraction too.
trailrendermode=<0,1,2>;
lines is 0,points is 1, quads is 2.
trailminspeed=<number>;
minimum unit speed required to have it.
trailwait=<number>;
time it takes to update the vertex array, usefull for lowering lag, high values = less lag, 1 is instant updates.
the examples:
Code: Select all
[customParams]
{
usetrail=1;
trailr=0.60;
trailg=0.35;
trailb=0.85;
traila=0.85;
trailwidth=3.00;
trailframes=15.00;
trailblendmode=0;
trailfadealpha=1;
traildrawinminimap=1;
traildrawshadow=1;
traildrawwater=1;
trailrendermode=0;
trailminspeed=5.00;
trailwait=2;
}
post your opinions about it.
and vote for me in
here.
and check out the
heightmap exporter, made by me.
also check out
weather effects.
Re: Ribbon Effects
Posted: 28 Feb 2008, 01:34
by user
added a new image and updated the information.
get ready to vote in me, its demo version is almost done.
Re: Ribbon Effects
Posted: 28 Feb 2008, 10:45
by Argh
Yay

I got quads to draw with a texture, but I haven't been able to figure out a cpu-friendly solution yet. I will happily test this...
Re: Ribbon Effects
Posted: 28 Feb 2008, 12:48
by KDR_11k
Weird, how does attaching to pieces work? If I wanted to attach trails to the feet of a unit, how would I do that?
Re: Ribbon Effects
Posted: 28 Feb 2008, 14:37
by Argh
Good question, but I'm sure changing to supply the position of the Piece would be pretty easy, if it just reads from the center of the Unit...
Re: Ribbon Effects
Posted: 28 Feb 2008, 16:11
by user
really you got quads?, if so, then we can wait some more time to release this.
the wait function reduces lag by a lot, just use a 3 frame wait, then no lag.
Weird, how does attaching to pieces work? If I wanted to attach trails to the feet of a unit, how would I do that?
if you really want that, then you will have to wait, what i will do first, is
making it properly work using the center of the unit as emit point.
Re: Ribbon Effects
Posted: 29 Feb 2008, 00:10
by Argh
I got quads, but it's not workable, really, I couldn't get the rest of it fast enough.
Problems:
1. To make a quad, I need to have the past locations of two points and the present locations of two points. I can get that from COB, or supposedly from LUA's unit-matrix thingy, which I don't know what to do with yet.
2. I couldn't ever get the code written that would "recognize" what was alive and should draw quads to run fairly fast. Doing a search of all Units every frame is very CPU-intensive, I wanted a faster approach, with a small list, but couldn't figure out a clean way to do that.
3. Dead units, or units which have quit moving, should have the quads fade out over time. This means I need a list of quads based on the time they spawned, so that they can be rendered in series (i.e., the next-oldest quad is slightly dimmer than the first one, etc.) and I couldn't figure out how to make that run efficiently.
4. Lastly, in an ideal world, the quads would get smaller with distance from the source. I can't figure out a way to do that, other than fudging it with an offset of the texture coordinates, and using a texture that incorporates a smaller line over distance. This would work pretty well, though.
I couldn't solve these problems, and I have burned up about a week and a half of development time on this stuff. I need to return to working on P.U.R.E. / World Builder now. That's why there hasn't been anything new from me.
Re: Ribbon Effects
Posted: 29 Feb 2008, 00:16
by user
1. using the linked list.
2. this new one does it.
3. shouldn't be hard.
4. we will think of it later.
post here the code, or PM me, then let me do it, so you can go back to work on PURE and World Builder.
Re: Ribbon Effects
Posted: 29 Feb 2008, 18:43
by user
ignore my post above, please.
the pieces should be named on the UnitDefs custom parameters, so when reading the pieces, it will look for the names on UnitDefs, look
here it has all we need, i will code the code for it(the unit def part, so argh code can get implement on this easily) .
Re: Ribbon Effects
Posted: 01 Mar 2008, 13:04
by jK
user wrote:ignore my post above, please.
the pieces should be named on the UnitDefs custom parameters, so when reading the pieces, it will look for the names on UnitDefs, look
here it has all we need, i will code the code for it(the unit def part, so argh code can get implement on this easily) .
it has not "all we need" ... (you need to go the cob way, which argh is going ..)
Re: Ribbon Effects
Posted: 01 Mar 2008, 13:12
by user
alright:
Code: Select all
Spring.GetUnitPiecePosition
( number unitID, number piece ) -> number posx, number posy, number posz
Spring.GetUnitPieceDirection
( number unitID, number piece ) -> number dirx, number diry, number dirz
Spring.GetUnitPieceMatrix
( number unitID, number piece ) -> { [1] = number, ... , [16] = number }
Spring.GetUnitPieceList
( number unitID ) -> { [1] = string "piecename", ... , [pieceNumN] = string "piecename" }
Spring.GetUnitPieceMap
( number unitID ) -> { "piecename1" = pieceNum1, ... , "piecenameN" = pieceNumN }
it has not "all we need" ... (you need to go the cob way, which argh is going ..)
it looks very good at the moment, if i forgot something about his lua to cob, then please post here.
have you read his topic?, i posted how should that get implemented:
read
here.
Re: Ribbon Effects
Posted: 04 Mar 2008, 00:58
by user
Code: Select all
Rev: 5555
Last modification: Rev 5555 - KDR_11k - 2008-03-04 00:13:43 +0100 (Tue, 04 Mar 2008)
Log message:
*Added SyncedRead call-out GetUnitPiecePosDir(unitID, piece), this returns the global position and forward vector of the given piece (6 return values in total). The emphasis is on global, the previous call-outs only deliver relative values.
this means it will be easier to finish this, right?
Re: Ribbon Effects
Posted: 18 Mar 2008, 00:16
by user
i think i will remake the drawing function to something better, since currently, it is limited, quad drawing doesn't seems possible, it doesn't draws any quads, no matter what i try, and i tried almost everything i could think of.
using the quads drawing code from the map texture widget i made, drawing quads for the trail will be very fast.
and the current tags are:
Code: Select all
[customParams]
{
usetrail=1;
trailr=0.60;
trailg=0.35;
trailb=0.85;
traila=0.85;
trailwidth=3.00;
trailframes=15.00;
trailblendmode=0;
trailfadealpha=1;
traildrawinminimap=1;
traildrawshadow=1;
traildrawwater=1;
trailrendermode=0;
trailminspeed=5.00;
trailwait=2;
}
trail min speed will be split into 3: trailminspeedx, trailminspeedy, trailminspeedz.
for trails drawn at piece positions, well, a simple rewrite will be needed, but i will think of it later, currently i will make it work drawn from the center, then after, make it draw on a piece, defined in UnitDefs.
post any suggestions here, even weird suggestions.
Re: Ribbon Effects
Posted: 18 Mar 2008, 00:59
by user
new unit def i made:
traildrawvector:
make the trail get drawn only if the unit is going on the vector direction,
this means that a values of x will make the trail get drawn only when it is going in the x direction.
how it will work: if the x speed is higher than y and z, then it gets drawn, else not.
setting it to only values like x, or z, or xy, or zy, is weird, and not good,
so probably it will be limited to only xz, xyz, or y.
Re: Ribbon Effects
Posted: 18 Mar 2008, 21:08
by KDR_11k
I used that GetUnitPiecePosDir function to make my trails work.
I'm using COB to control the trails, it can add and remove trails on any piece (but not two trails on one piece at the same time).
Currently it can only use one texture and color per unit (trail lengths, vertex counts and widths are already changeable) but it should be trivial to let COB select one trail setting out of a bunch.
Each unit uses only one trail in that pic for performance reasons, they start eating the FPS quickly (60 of these trails cause a notable drop I think, haven't tested how much of that is from the units though).
Yes these will work for sword swings.
Re: Ribbon Effects
Posted: 18 Mar 2008, 22:09
by user
do they use quads?, is it very customizable like mine?
how does it draw stuff?, one "begin end" for every point, or just one for all points?
mine was made to be easy to use for every mod, and to be very customizable, almost every value can be changed, it currently has a bunch of UnitDefs, almost all are optional, they are working, they are very complete, and lots more are to come, and i have a simple idea of how i will make every piece trail customizable using only UnitDefs.
mine uses only UnitDefs, so a cob noob can make awesome stuff using this.
Each unit uses only one trail in that pic for performance reasons, they start eating the FPS quickly (60 of these trails cause a notable drop I think, haven't tested how much of that is from the units though).
i remember a test i made on my trail effects, it had a huge air battle(huge i mean a lot of aircrafts, way more than 50, i would say 100 to 200 or more), very long trails, no wait for draw, no minimum speed, it worked fine, with lag, but not that much, not sure if i have any screens of it.
look at the first 6 screens, the first, second and third, was an air battle with around 60 aircraft, not much lag, i could still play fine.
the fourth and fifth screens were an air battle on a air only map i made, that was a big battle.
i will release a demo of mine soon, so get ready.
by the way, sorry for asking so many things, its because you haven't posted much details.
Re: Ribbon Effects
Posted: 18 Mar 2008, 23:09
by KDR_11k
It has r,g,b,alpha,texture,width,rate (of points getting recorded),ttl. RGBA and tex are currently fixed per-unit
Why in hell's name would I use beginEnd for every point? It uses one TRIANGLE_STRIP for the trail, anything else would force me to resend every vertex multiple times..
"not much lag", sure. At 60 it remains playable, just drops to 30 from 45 or something like that. A battle of 120 fighters gets really laggy but that might be the gigantic number of projectiles flying around (I've tested with Daggers which shoot 8-12 projectiles per second and have those projectiles persist a few seconds). Did a quick test, 120 dagger without trails run at 41 FPS, with trails at 32 (daggers use trails consisting of 8 nodes). Guess it's not as bad as I thought, still I prefer using a texture to deal with multiple engines.
BTW, what's your logic for determining if a trail is in LOS? Mine is "is the cause in LOS?".
Also how do you enable/disable your trails without COB?
Re: Ribbon Effects
Posted: 18 Mar 2008, 23:26
by Argh
You can enable / disable trails by doing a check of the Unit's Velocity.
Re: Ribbon Effects
Posted: 18 Mar 2008, 23:31
by user
alright, by the way, sorry for asking so many things, its because you haven't posted much details.
i know it is very annoying to post questions like mine,
sorry.
Why in hell's name would I use beginEnd for every point? It uses one TRIANGLE_STRIP for the trail, anything else would force me to resend every vertex multiple times..
a lot of people do it, i had to ask, because most of the times it is a per quad begin end.
It has r,g,b,alpha,texture,width,rate (of points getting recorded),ttl. RGBA and tex are currently fixed per-unit
mine has r,g,b,a,width,wait(same as rate), life(same as ttl), min speed x,min speed y, min speed z, draw in water, draw shadow, draw in minimap, draw vector, render mode(3 options, more to come), blend mode(3 options, more soon) , it only lacks quads and textures.
"not much lag", sure. At 60 it remains playable, just drops to 30 from 45 or something like that. A battle of 120 fighters gets really laggy but that might be the gigantic number of projectiles flying around (I've tested with Daggers which shoot 8-12 projectiles per second and have those projectiles persist a few seconds). Did a quick test, 120 dagger without trails run at 41 FPS, with trails at 32 (daggers use trails consisting of 8 nodes). Guess it's not as bad as I thought, still I prefer using a texture to deal with multiple engines.
i think you didn't understood what i meant, i mean that
huge battles cause very few lag.
there are some things argh suggested before, that i know how to make, and are coming soon.
BTW, what's your logic for determining if a trail is in LOS? Mine is "is the cause in LOS?".
very good idea, i will make a UnitDef value for that, people will be able to choose which method from a bunch, and i know how to make it.
Also how do you enable/disable your trails without COB?
You can enable / disable trails by doing a check of the Unit's Velocity.
it has 3 defs for that currently.
Re: Ribbon Effects
Posted: 19 Mar 2008, 00:05
by KDR_11k
Yeah but that wouldn't work if the trail wasn't just meant to be triggered by velocity, e.g. a smoketrail if an engine is damaged...
I guess your approach works better for TA mods that just want to add trails to simple planes (especially without adjusting any COB) while mine would work better for things that aren't real trails like sword slashes.