how to make ribbon trail effect?
by gdyxml2000 · in Torque 3D Professional · 07/05/2014 (11:00 pm) · 58 replies
how to make ribbon trail effect?
About the author
#2
If an axe wielding a circle With the 2 seconds ,Particle effects like a circle .but, if wielding a circle With the 0.4 seconds, The particle is not connected into line, but a few sparse point.

ribbon trail should like :

or effect like orge engine ribbon trail in character demo .
07/05/2014 (11:16 pm)
that's not really ribbon trail !If an axe wielding a circle With the 2 seconds ,Particle effects like a circle .but, if wielding a circle With the 0.4 seconds, The particle is not connected into line, but a few sparse point.

ribbon trail should like :

or effect like orge engine ribbon trail in character demo .
#3
07/06/2014 (2:36 am)
Simples way I can think of is to stick the trail on a card and animate the alpha to reveal the trail behind the weapond.
#5
07/06/2014 (3:44 am)
great,thanks lukas Joergensen! your improve partiles project is very amazing ! and i use it for my project! thanks for ribbons helps!
#6
http://www.garagegames.com/community/blog/view/22378
It's a particle effect so you can change the random offset of the particles as they're emitted so it's not all jagged.
07/06/2014 (8:12 am)
Use this like Stephen said http://www.garagegames.com/community/blog/view/22378
It's a particle effect so you can change the random offset of the particles as they're emitted so it's not all jagged.
#7
this is my .cs code:
datablock RibbonData(ribbontest)
{
size[0] = "0.1";
size[1] = "0";
size[2] = "0";
size[3] = "0";
color[0] = "0.933333 0.0980392 0.329412 1";
color[1] = "0.117647 0.654902 0.886275 1";
color[2] = "0.184314 1 0 1";
color[3] = "1 0.67451 0 1";
RibbonLength = "100";
category = "ribbontrail";
position[0] = "31.832";
position[1] = "-20.1508";
position[2] = "246.404";
position[3] = "1";
RibbonMaterial ="xx_mat1";
};
singleton Material(xx_mat1)
{
mapTo = "xx_mat1_yy";
diffuseMap[0] = "art/particles/fireball.png";
normalMap[0] = "art/particles/fireball.png";
specularMap[0] = "art/particles/fireball.png";
diffuseColor[0] = "1 1 1 1";
specular[0] = "0.9 0.9 0.9 1";
specularPower[0] = 10;
};
this is my call .cs code:
%eff3 = new Ribbon() {
dataBlock = ribbontest;
};
%npc.mountObject(%eff3 ,1);
but have no effect
07/07/2014 (9:39 am)
lukas Joergensen,can you give me an useage for Tim's ribbons code ?this is my .cs code:
datablock RibbonData(ribbontest)
{
size[0] = "0.1";
size[1] = "0";
size[2] = "0";
size[3] = "0";
color[0] = "0.933333 0.0980392 0.329412 1";
color[1] = "0.117647 0.654902 0.886275 1";
color[2] = "0.184314 1 0 1";
color[3] = "1 0.67451 0 1";
RibbonLength = "100";
category = "ribbontrail";
position[0] = "31.832";
position[1] = "-20.1508";
position[2] = "246.404";
position[3] = "1";
RibbonMaterial ="xx_mat1";
};
singleton Material(xx_mat1)
{
mapTo = "xx_mat1_yy";
diffuseMap[0] = "art/particles/fireball.png";
normalMap[0] = "art/particles/fireball.png";
specularMap[0] = "art/particles/fireball.png";
diffuseColor[0] = "1 1 1 1";
specular[0] = "0.9 0.9 0.9 1";
specularPower[0] = 10;
};
this is my call .cs code:
%eff3 = new Ribbon() {
dataBlock = ribbontest;
};
%npc.mountObject(%eff3 ,1);
but have no effect
#8
You can see the ribbon code in use here from the TGEA days of our engine - www.youtube.com/watch?v=3dZdFngXGXs
The gun fire from the ships is similar to the shader I gave Lukas.
Anyway on actually creating a ribbon, unless Lukas changed it, you have to create them in C++ and then call the function to generate the spline points. For instance if you wanted a projectile with a ribbon, you would add a Ribbon variable to the projectile class as well as a variable to ProjectileData so you can set the RibbonData datablock and then add a segment each frame the projectile is updated. I cant remember the name of the function to add a segment off hand but its something like AddSegmentSomething I think :) You can look it up in the source. If you are not that good at doing C++ code or know how torque works, you may want to wait and let lukas finish the integration first.
I had been planning to add this into stock Torque for a while but have not had time so I sent the code over to Lukas so he could. This code was written for our mech game because particle effects were too much of a drain with all the weapon fire we have going on. That is why it is not very user friendly in a general sense :) Maybe Lukas can fix that with an integration.
07/08/2014 (5:58 am)
Unless lukas made changes to my code, it does not support shadergen or the way you are trying to create the ribbon. You have to use a CustomMaterial with special ribbon shaders due to the data the ribbon code passes in. They are pretty simple shaders though, I gave Lukas an example one that renders a glowing ribbon like a laser bolt.You can see the ribbon code in use here from the TGEA days of our engine - www.youtube.com/watch?v=3dZdFngXGXs
The gun fire from the ships is similar to the shader I gave Lukas.
Anyway on actually creating a ribbon, unless Lukas changed it, you have to create them in C++ and then call the function to generate the spline points. For instance if you wanted a projectile with a ribbon, you would add a Ribbon variable to the projectile class as well as a variable to ProjectileData so you can set the RibbonData datablock and then add a segment each frame the projectile is updated. I cant remember the name of the function to add a segment off hand but its something like AddSegmentSomething I think :) You can look it up in the source. If you are not that good at doing C++ code or know how torque works, you may want to wait and let lukas finish the integration first.
I had been planning to add this into stock Torque for a while but have not had time so I sent the code over to Lukas so he could. This code was written for our mech game because particle effects were too much of a drain with all the weapon fire we have going on. That is why it is not very user friendly in a general sense :) Maybe Lukas can fix that with an integration.
#9
07/09/2014 (4:58 am)
I'm still considering the best approach, adding a ribbon field to to the projectile could be one way, but i'm considering some other ways to do this ;)
#10
07/09/2014 (6:35 am)
Being able to script it would be cool, but it might be a bit slow unless you can dumb down the number of calls. Maybe a RibbonEmitter object that you can just say Go to the X,Y,Z and it builds a ribbon along the way. Wouldnt really be useful for projectiles but it would be a general use case.
#11
07/09/2014 (6:53 am)
I think you'd want to be able to create the effect from script with a datablock for the parameters, not control it from script. Your RibbonEmitter sounds like a great idea - as you say, not for projectiles but for other uses (like the sword swing mentioned above). Something that would construct and manage the effect. And it would be useful for guided missiles - ever play Descent: Freespace?
#12

Having ribbons scriptable with a datablock holding vars for length, material, etc would be user friendly. Whilst Tim did send me the code a bit ago I've been snowed under and not had a chance to give it a look.
07/09/2014 (8:41 am)
Yes, Mr Ranft. Yes I did.
Having ribbons scriptable with a datablock holding vars for length, material, etc would be user friendly. Whilst Tim did send me the code a bit ago I've been snowed under and not had a chance to give it a look.
#13
07/09/2014 (10:36 am)
So you know exactly what I'm talking about when I mention those missiles! They looked great! And that code is floating around out there too, by the way. Parallax open-sourced (non-commercial) the Descent: Freespace 2 code a while back - see the Freespace 2 Source Code Project, in case anyone missed it.
#14
Implemented a "RibbonNode" class (pretty rough, almost a straight copy-paste from ParticleEmitters), you can mount it to stuff to get ribbon on it.
I'll keep working on this untill I have a nice implementation, but for now you can work with that :)
Datablocks
Shaders
Branch is still here.
07/14/2014 (1:43 pm)
@gdyxml2000Implemented a "RibbonNode" class (pretty rough, almost a straight copy-paste from ParticleEmitters), you can mount it to stuff to get ribbon on it.
I'll keep working on this untill I have a nice implementation, but for now you can work with that :)
Datablocks
Shaders
Branch is still here.
#15
07/14/2014 (2:46 pm)
Sweet! That looks awesome.
#16
07/14/2014 (2:46 pm)
That's cool Lukas. Would it possible to assign a texture/material to that?
#17
07/14/2014 (2:59 pm)
Sure, just make a shader that samples a textures. Not quite sure how, but I'm certain it's possible :P
#19
07/15/2014 (9:50 am)
thanks Tim! thanks Lukas! very cool !
Torque Owner Stephen
GearedMind Studio
www.garagegames.com/community/blog/view/22378