Page 1 of 2

Trail Meshes

Posted: Tue Apr 01, 2014 4:22 pm
by Spyro
Well, I have been seeing many others creating trails using the particle systems that LOVE2D has provided, but what I seen in some other games is that they use a ribbon type of mesh that gets created. Basically what I wanted to share is similar to this using the new version of LOVE2D (0.9.0). Not sure if anyone else has made one yet.

Settings:
(x, y, image, width of trail/ribbon, trail lifetime, interval (how "detailed" the trail is), method ("stretch" default, "repeat"))
or you can look at the file itself to see how it works

I'm still new to this so if the script is quite dirty, please tell me if there is a was to optimize it, math is still fresh in my mind since I'm still in school so I might understand what you may say. Also I am trying to understand classes more, I'm used to python.

Re: Trail Meshes

Posted: Sun Apr 06, 2014 1:50 am
by NightKawata
Very nice.

Image

Just an image if anyone wanted to see what this looked like.

Re: Trail Meshes

Posted: Tue Apr 08, 2014 4:18 pm
by Spyro
Yea, that is how it looks like. If he would have moved the mouse faster you would see the little things that orbit the circle follow the same behavior. My only problem is the overlapping where you can see lighter parts an random cuts when you stop for a moment then move again.

To me I think it would look better when used with a game that has some sort of physics. (either one made up or used by the 2d box physics engine) instead of something that is... well, stiff like the mouse.

Re: Trail Meshes

Posted: Sat May 31, 2014 2:22 pm
by R-BG
I'm using this in my game. Thank you very much.

Re: Trail Meshes

Posted: Sun Jan 11, 2015 9:52 pm
by Taehl
Amazing! I've wanted this feature for years! :awesome:

Seriously, ribbons are a powerful basic tool for adding visual flair, much like particle effects. Blizzard has used them in every game of theirs since 'Warcraft 3'. If I could request any feature to be added to this, it would be the ability to add motion to individual trail "points". This would open up even more graphical possibilities, like some of the fancier effects used in 'Half-Life 2: Episode Two'.

EDIT) Take that, mysterious code! I modified it so each trail point can have its own position and velocity. I've uploaded my improved version of your demo, download it here!.

Image
What's added:
- A bit of cursor smoothing (it makes everything look much nicer)
- Colors
- A second, thicker dotted trail, except this one "jets out" opposite the motion of the cursor
- A fourth blue trail, except this one changes width and drifts upward and reacts to cursor motion somewhat like smoke
- A green trail which just moves to the right. Simple, but pleasing to watch

Re: Trail Meshes

Posted: Fri Jul 17, 2015 2:21 am
by netgrim
The way vertices disapears after it's life time is weird
remove.png
remove.png (2.39 KiB) Viewed 8663 times
And line joint are bad when angle is sharp
line joint.png
line joint.png (5.61 KiB) Viewed 8663 times
I will work on that

Re: Trail Meshes

Posted: Mon Jul 20, 2015 7:31 pm
by Spyro
If you can post a fix of it, that would be great for others to see, this was my first attempt to achieve what other game engines has been doing, like I said its dirty but gets most of the job done. I'll probably edit the first post, its been a while since I used lua but im still used to it. Maybe better preview images too. Its up to you anyways. :)

Re: Trail Meshes

Posted: Mon Jul 20, 2015 7:57 pm
by Muzz
I think this would make a great little library that would be super helpful to people ;).

Re: Trail Meshes

Posted: Wed Jul 22, 2015 1:55 am
by netgrim
I managed to fix the vertex removal problem,
Fixed the texture was flipped
I have completely rewritten the library using vector.lua and merged the method "stretch" and "repeated" together
I have added a color transition like in ParticuleSystem
I'm working on the line joint problem
and I will add a width transition after a look on Taehl's work

The vertex index is for debug purpose
ending fixed.png
ending fixed.png (27.17 KiB) Viewed 8555 times

Re: Trail Meshes

Posted: Wed Jul 22, 2015 3:47 am
by Taehl
Superb work! I'm so glad this is being refined. If you need help dissecting my code, or would rather discuss the concept rather than my implementation, please feel free to contact me.

The general idea is, you want trail points to be able to independently execute simple transformations, rather than just staying in at their point of creation.