Game Development Community

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?
Page«First 1 2 3 Next»
#41
07/30/2014 (8:30 am)
New repo confirmed for fixed visual issue I post above. :)
#42
07/30/2014 (10:16 am)
And now the repo also has a setting for preventing texture stretching



Edit: Above video shows all the added features since I received the code from Tim
#43
07/30/2014 (11:45 am)
One of the common approaches these days is to use a scale animation in the vertex shader based on a velocity curve. It works a lot faster than this solution. I can give some pseudo glsl code, just don't have the time to port it to T3D.
#44
08/02/2014 (7:50 pm)
thanks lukas, this is my effect with your code :
data2.whicdn.com/images/130102069/large.pngdata3.whicdn.com/images/130102219/large.pngdata1.whicdn.com/images/130102279/large.pngdata3.whicdn.com/images/130102411/large.pngdata1.whicdn.com/images/130116886/large.png
#45
08/02/2014 (8:11 pm)
That looks very nice - good work everyone!
#46
08/19/2014 (5:29 am)
@Lukas,in the Hosted Server model,every thing is ok, in the Dedicated Server model will be crashed, in the ribbonNode.cpp ,at line 219:

stream->writeRangedU32(mRibbonDatablock->getId(), DataBlockObjectIdFirst,
            DataBlockObjectIdLast);

how to fix ?
#47
08/19/2014 (2:36 pm)
Quick question, with the ribbons, is it possible to make them grow and fade, so I could use it for a boat wake?
#48
08/20/2014 (5:21 am)
@ scott przybylski , it is support grow and fade.
#49
09/04/2014 (4:56 am)
@gdyxml2000, sorry for not getting back sooner.. Did you ever get it fixed?
#50
11/04/2014 (11:35 am)
Noticed something a bit odd when testing the ribbons, demonstrated in this image. Red is this implementation, blue is the particle based ribbon. Both of them are mounted to the moving car. Any idea on what is causing the ribbon to periodically make rectangles?
#51
11/04/2014 (12:13 pm)
perhaps motion of the vehicle - it looks like it might be bouncing back and forth, causing the ribbon to change direction and create a new segment.
#52
11/04/2014 (1:21 pm)
Another test. Same behaviors as before when testing them attached to high speed rigidshapes. I noticed that the distance between the steps in the red ribbon was directly related to the speed it was going at the time.
#53
11/04/2014 (1:32 pm)
alfalfa, could you post some code to let us reproduce this?
#54
11/04/2014 (1:42 pm)
That looks like an issue I tried fixing some time ago.
What it seems to me that happens, is that the texcoords is not wrapping properly.. I.e. it tries to go from 1 to 0 in a very short distance such that it can begin counting towards 1 again. This could be more obvious if the ribbon had a texture or changed size over time.

My original solution was to simply let the Ribbon count upwards, so instead of going to texCoord 0 it would continue to count to 2 and onwards.

What I think happens with the texcoords:
0 - 1,0 - 1,0 - 1

What should happen:
0 - 1 - 2 - 3

Maybe it's a stateblock thing? It might not be wrapping properly.
#55
11/04/2014 (1:58 pm)
Not much code involved here. Just stick this in Empty Terrain.mis in a build that has the ribbon code.
new WheeledVehicle() {
      disableMove = "0";
      isAIControlled = "0";
      dataBlock = "CheetahCar";
      position = "-26.1608 -418.364 248.942";
      rotation = "0.1787 0.032169 -0.983378 80.0981";
      scale = "1 1 1";
      canSave = "1";
      canSaveDynamicFields = "1";
      persistentId = "cae947fc-646c-11e4-b445-948afcb407a6";
         leftBrakeLight = "7238";
         mountable = "1";
         rightBrakeLight = "7237";
   };
   new RibbonNode(Test) {
      active = "1";
      Ribbon = "BasicRibbon";
      dataBlock = "DefaultRibbonNodeData";
      position = "-23.8005 -418.433 252.466";
      rotation = "0.1787 0.032169 -0.983378 80.0981";
      scale = "1 1 1";
      mountPID = "cae947fc-646c-11e4-b445-948afcb407a6";
      mountNode = "-1";
      mountPos = "0 -3 3";
      mountRot = "1 0 0 0";
      canSave = "1";
      canSaveDynamicFields = "1";
      persistentId = "ea9afef9-646c-11e4-b445-948afcb407a6";
   };
#56
11/11/2014 (3:42 pm)
Just to point out, I think that ribbons and some other objects that are mounted after being created seperately "lose synch" with the moveUpdate. I remember someone posting an old thread about a helicoptor with seperate rotorblades mesh which lost synch when moving.

If you spawn and mount the ribbons in the vehicle's (cheetah.cs) own onAdd() function - in otherwords before it is fully created in world - this should solve the issue that you are seeing.

Depending on how long and how many section you have you may notice a slight artifact on a dramatic slowdown like hitting the breaks at full speed.

www.yorkshirerifles.com/random/ribbons_cheetah.jpg
#57
11/21/2014 (9:34 pm)
I've written a dedicated class for this for a project of mine. It uses mesh rather than particle rendering, so it uses torque materials, allowing animation, glow, etc.

i.imgur.com/bzzp3Ok.png

It's really, really, *really* primitive (and somewhat buggy), but might be useful as a starting point.

The class itself: multiNodeLaserBeam.h | multiNodeLaserBeam.cpp.

MultiNodeLaserBeam datablocks used in the screenshot above: etherform.gfx.cs

Materials used by the datablocks: materials.cs

Used to implement trails for projectiles: projectile.h | projectile.cpp (search for "MultiNodeLaserBeam" to find the relevant parts).
#58
11/24/2014 (5:30 pm)
Cool! We'll have to evaluate this one as well :). Would be nice if someone who knows about GFX could comment on the pros/cons of each approach.
Page«First 1 2 3 Next»