How to draw this contrail?

General discussion about LÖVE, Lua, game development, puns, and unicorns.
User avatar
appleide
Party member
Posts: 323
Joined: Fri Jun 27, 2008 2:50 pm

How to draw this contrail?

Post by appleide » Mon Apr 14, 2014 3:05 pm

I saw this cool spaceship-engine-contrail effect in a game called "starsector".
Screen Shot 2014-04-15 at 12.53.13 am.png
from starsector
Screen Shot 2014-04-15 at 12.53.13 am.png (72.5 KiB) Viewed 4454 times
I was trying to recreate it in love2d but am quite far from it:
Screen Shot 2014-04-15 at 12.59.40 am.png
Screen Shot 2014-04-15 at 12.59.40 am.png (9.03 KiB) Viewed 4454 times
How would I do something like the first screenshot? :brows:

The shape of my contrail looks nowhere near the one I'm trying to blatantly copy.

I've also uploaded a version of particleedit ported to 0.9.1, originally from viewtopic.php?f=4&t=2110.
Attachments
particleedit.love
(17.83 KiB) Downloaded 166 times

User avatar
Ranguna259
Party member
Posts: 911
Joined: Tue Jun 18, 2013 10:58 pm
Location: I'm right next to you

Re: How to draw this contrail?

Post by Ranguna259 » Mon Apr 14, 2014 4:00 pm

You are telling me that your name if in orange color and you posted in the wrong section of the forum ?
LoveDebug- A library that will help you debug your game with an on-screen fully interactive lua console, you can even do code hotswapping :D

Check out my twitter.

User avatar
Davidobot
Party member
Posts: 1187
Joined: Sat Mar 31, 2012 5:18 am
Location: Cambridge, UK
Contact:

Re: How to draw this contrail?

Post by Davidobot » Mon Apr 14, 2014 4:17 pm

Ranguna259 wrote:You are telling me that your name if in orange color and you posted in the wrong section of the forum ?
Give him/her a break, his/her last post was nearly 3.5 years ago.
My projects: Raycaster, love.js v11.3 port
itch page: link
My website: link
My library: LovelyMoon

Rockford
Prole
Posts: 26
Joined: Fri Mar 14, 2014 9:40 pm
Location: USA

Re: How to draw this contrail?

Post by Rockford » Mon Apr 14, 2014 4:45 pm

What does an orange name signify?

Germanunkol
Party member
Posts: 710
Joined: Fri Jun 22, 2012 4:54 pm
Contact:

Re: How to draw this contrail?

Post by Germanunkol » Mon Apr 14, 2014 4:49 pm

I assume you don't want the trail to "turn" with the ship (i.e. when the ship turns then the trail should describe a curve and not spin around with the ship - the latter can also look good if the ship is moving fast enough, but is trivial to program - just attach a static sprite, maybe variate the alpha/color a bit and make it follow the ship).

I think it might look better with streched particles, i.e. particles which are longer than they are wide.
But I've never used particles in Löve...

Another way might be meshes - seting up a static trail should not be hard: create a new mesh, use an image which is 1 pixel wide and about 20 pixels high, with a gradient fading from transparent to bright white and back to transparent. Make sure the image's mode is set to "repeating".
Then create 4 vertecies for each "segment", create multiple segments after each other (going to the side, in the direction where the image is just 1 pixel wide). Make sure to re-use the same texture coordinates (the corners of the image) for each segment, but different screen coordinates.

Make sure to set blend mode to additive.

Moving this thing (using the second method) could however be dificult...
Come to think of it, I think I'll try programming this... I'll let you know if I can get it to work.
trAInsported - Write AI to control your trains
Bandana (Dev blog) - Platformer featuring an awesome little ninja by Micha and me
GridCars - Our jam entry for LD31
Germanunkol.de

User avatar
Ranguna259
Party member
Posts: 911
Joined: Tue Jun 18, 2013 10:58 pm
Location: I'm right next to you

Re: How to draw this contrail?

Post by Ranguna259 » Mon Apr 14, 2014 5:06 pm

Davidobot wrote: Give him/her a break, his/her last post was nearly 3.5 years ago.
Yeah you're right, sorry about that.. and back on topic

Germanunkol if you are good with shaders then you could also add a glow effect where the mesh/particles starts, an oval object that fades it's color from the center to the edges maybe ?
LoveDebug- A library that will help you debug your game with an on-screen fully interactive lua console, you can even do code hotswapping :D

Check out my twitter.

User avatar
Davidobot
Party member
Posts: 1187
Joined: Sat Mar 31, 2012 5:18 am
Location: Cambridge, UK
Contact:

Re: How to draw this contrail?

Post by Davidobot » Mon Apr 14, 2014 6:12 pm

Rockford wrote:What does an orange name signify?
That the person is a moderator.
My projects: Raycaster, love.js v11.3 port
itch page: link
My website: link
My library: LovelyMoon

User avatar
slime
Solid Snayke
Posts: 2902
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: How to draw this contrail?

Post by slime » Mon Apr 14, 2014 6:44 pm

Davidobot wrote:
Rockford wrote:What does an orange name signify?
That the person is a moderator.
Not quite. It just means they are/were a developer of LÖVE.

User avatar
Uradamus
Prole
Posts: 2
Joined: Sat Mar 22, 2014 6:17 pm

Re: How to draw this contrail?

Post by Uradamus » Mon Apr 14, 2014 6:46 pm

Here is my take on that particle effect. I am using two particle systems, one in the background for the smoke like effect, then another on top for the flames. Feel free to do whatever you want with the script or the images.
Attachments
contrail.love
(28.06 KiB) Downloaded 189 times

User avatar
Davidobot
Party member
Posts: 1187
Joined: Sat Mar 31, 2012 5:18 am
Location: Cambridge, UK
Contact:

Re: How to draw this contrail?

Post by Davidobot » Mon Apr 14, 2014 6:49 pm

slime wrote:
Davidobot wrote:
Rockford wrote:What does an orange name signify?
That the person is a moderator.
Not quite. It just means they are/were a developer of LÖVE.
Ah, yes. Pardon me. That's the green names.
My projects: Raycaster, love.js v11.3 port
itch page: link
My website: link
My library: LovelyMoon

Post Reply

Who is online

Users browsing this forum: No registered users and 31 guests