Page 1 of 3

Ribbon effects.

Posted: 17 Feb 2008, 00:15
by smoth
Image
IN BEFORE SOME IDIOT SUGGESTS CEG EMIT DOES THIS!

I am not sure if anyone has the time or energy to add this as a patch to spring, but a ribbon effect would be fantastic. Some ideal tags would be:

Repeat // bool to say if ribbon texture should repeat
Stretch //bool, texture stretches ribbon length
Blendmode // option to specify: subtractive, additive or overlay
texture // texture for ribbon
length //how long in game units is it?
width //how wide is it

Re: Ribbon effects.

Posted: 17 Feb 2008, 01:22
by [Krogoth86]
Ehm - could you please explain in detail what exactly you ask for here? Because to my mind this beam effect can be done with the new LargeBeamLaser tag... :?

Re: Ribbon effects.

Posted: 17 Feb 2008, 02:39
by Gnomre
And when the unit, you know, turns?

Re: Ribbon effects.

Posted: 17 Feb 2008, 02:48
by smoth
Image

I don't know how it is done, I always assumed it was a poly strip. A ribbon effect works much like a ribbon attached to something. When the unit turns it bends see above shot for another example with bending ribbons.

Re: Ribbon effects.

Posted: 17 Feb 2008, 06:52
by Argh
It's just a poly strip, like the poly strip for the missile trails.

Tbh, that looks like a job for LUA, to me.

That code in the missile stuff could almost be ported straight over to unsynched LUA with only minor rewrites, given that you'd mainly just need to grab some of the math from the includes and rewrite the syntax. I may get to that at some point, when I'm working on the aircraft for P.U.R.E. again, if nobody else does anything.

Re: Ribbon effects.

Posted: 17 Feb 2008, 07:58
by KDR_11k
Ah okay, units, not weapons.

Doesn't CA already do this with LUPS?

Re: Ribbon effects.

Posted: 17 Feb 2008, 16:52
by jK
I always wanted to write such a fx class for the wingtips of planes
(like supcom it has), but the Lua API is still missing some functions
to do so.

The issue is that you need to know the exact model piece position
you want to attach the fx to. To do so you need the offset and rotation
of the model piece (doable) and the unit's upright coords (not
doable).

So you can try to determine it with GetUnitHeading() etc., but those
calls don't work always (i.e. they don't work for planes).
LUPS had such issues with 75b2, so there are now the new
gl.UnitPieceMultMatrix() and gl.UnitMultMatrix() calls, but they do an
opengl modelview transformation, so you would have to save for
each polystrip vertex a 4x4 matrix or (what is much harder) you have
to extract the wanted information from the matrices.

Also there is the possiblity to determine the piece position in synced
lua code with Spring.GetCOBUnitVar(), but then you would have to
send it to the unsynced side etc. and like the GetUnitHeading variant
it doesn't always return valid positions.


So atm it isn't possible to do something like that in Lua, but I will
write a patch soon (my bug list is long ;)), so we will have something
like that hopefully in 76b2.

Re: Ribbon effects.

Posted: 17 Feb 2008, 17:35
by Argh
I've already figured out a way to do this, with one tiny LUA check, COB, and emit-sfx.

Re: Ribbon effects.

Posted: 17 Feb 2008, 18:27
by AF
explosion generators are hardly useful for this because you either get a pretty looking effect that involves way too many particles that makes the polystrip method look like a quantum computer from the year 30,129 in terms of speed, or the fugly trails that seem to be in every mod where you see individual particles despite it supposed to be looking like a trail which means a smooth blur not individual blobs.

Re: Ribbon effects.

Posted: 17 Feb 2008, 19:10
by Argh
Well, it's not quite as cool as a true polystrip, to be sure. However, it's not too bad. I'll look at the polystrip code when I get home, it's probably possible to do that by getting exact part locations from COB and delivering them to LUA...

Re: Ribbon effects.

Posted: 17 Feb 2008, 19:12
by jK
Argh wrote:.. it's probably possible to do that by getting exact part locations from COB and delivering them to LUA...
jK wrote:Also there is the possiblity to determine the piece position in synced
lua code with Spring.GetCOBUnitVar(), but then you would have to
send it to the unsynced side etc. and like the GetUnitHeading variant
it doesn't always return valid positions.

Re: Ribbon effects.

Posted: 17 Feb 2008, 20:14
by Argh
I would think that the main issue is with GetUnitHeading, given what you're saying. Delivering that via COB isn't that big of a deal- just do some simple trig and get a vector that's entirely accurate. Slow math, not something you want to update very often, but perfectly doable.

You're not going to want to show these ribbons unless your aircraft is moving at something close to cruising speed, anyhow. The only reason why I even want to do a polystrip is because of joins, the rest of it's not a real issue, tbh.

I'm kind've concerned about the polystrips being a mess in terms of CPU usage, though, like the polystrip code for MissileWeapons (the CPU gained back by finally being able to turn that off almost offset the CEGtag stuff in P.U.R.E.)- is there a way to do those transforms on the GPU? That'd be ideal.

Re: Ribbon effects.

Posted: 19 Feb 2008, 07:11
by smoth
smoth wrote:IN BEFORE SOME IDIOT SUGGESTS CEG EMIT DOES THIS!
Argh wrote:I've already figured out a way to do this, with one tiny LUA check, COB, and emit-sfx.
WE HAVE A WINAR!

Re: Ribbon effects.

Posted: 19 Feb 2008, 14:31
by Argh
The sad part is that solving this was easy, but it got me looking at the aircraft code again, because tests quickly showed that every aircraft's velocity was increasing at precisely the same rate :P

Re: Ribbon effects.

Posted: 19 Feb 2008, 15:24
by smoth
You didn't solve anything. This was a feature request, not a how does I make a lumpy looking trails using a ceg. Unless you created a ribbon effect, which you didn't if you used ceg.

furthermore, I would prefer if the ribbons were a feature of the engine and not lua. I would have posted this in the lua forum if I was looking for a lua solution. Lua is interpreted/compiled/whatever at runtime. A hardcoded feature is more efficient, many mods are going to have shit tons of lua as are the maps they are in. I am afraid of putting too much in lua, both because I am not convinced it is stable and I to not want too much activity in lua as we are already eating ~10-15 fps with simple things like ui. However, JK, if you have something similar done, can I look at it to see how you did it? I am not doing any lua effects any time soon but I am curious about how these things are written.

*jk, not trying to sound rude, I am just in a hurry, and I needed to type ir really quick

Re: Ribbon effects.

Posted: 20 Feb 2008, 02:28
by Fanger
Argh you cant make a "solution" if you havent solved the problem by what your doing..

Why must everything be hack workaround.. no we need an actual ribbon code entered into the engine.. that can be textured, and controlled with tags in weapons and for units as well..

WE NEED RIBBON!!!
Image

Re: Ribbon effects.

Posted: 21 Feb 2008, 19:02
by Relative
Woah, what is that from?

Re: Ribbon effects.

Posted: 21 Feb 2008, 19:25
by imbaczek
Fang: actually, Lua can do everything that the engine can that's going to be needed to solve this problem, so a prototype in Lua won't hurt and may in fact be enough.

Re: Ribbon effects.

Posted: 22 Feb 2008, 06:22
by Zpock
It's easy to do in LUA if you know a little math. More flexibility than anything hardcoded too.

Re: Ribbon effects.

Posted: 22 Feb 2008, 07:44
by smoth
would you mind doing an example? Also could it be attached to a projectile?