achieve this lightning effect

This forum is currently in read-only mode.
0 favourites
From the Asset Store
J-BoB Magic Series LIGHTNING Sound Pack comes with 465 high-quality sound effects
  • Hi there,

    I know there is already a lightning effect .cap example, but it doesn't work on dynamic angles (I think) and doesn't looks smooth like the following example:

    http://blog.oaxoa.com/wp-content/examples/showExample.php?f=lightning_test5.swf&w=730&h=680

    Is the math very complicated behind it? I can feel it has something to deal with sine and cosine. Don't want these sliders and adjustments, just the effect.

    edit: just remembering this one from tulamide.

    Maybe in some way, it's possible with this editor to create this effect.

    edit2: just recognized, that there isn't a .cap from the editor^^

  • my guess is a 1D perlin noise combined with an offset polygonal line (see steps parameter). add a fancy glow effect and you're good to go.

    if you set the speed pretty close to 0 one can see, that all arc-branches are kind of "aware" of another. it looks like the noise-function behind affects all branches at once, so more like 2D-noise.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thank you, looks like a good idea, but I hadn't worked much with perlin(bad me ><). But maybe I get something interesting while trying it out^^.

  • This isn't much, but it's something xD

    Didn't use perlin yet, but well....

    http://dl.dropbox.com/u/26932498/crazy_line.cap

  • Don't really see the need for perlin.

    http://dl.dropbox.com/u/666516/lightning.cap

  • Really nice solution. I'll look for a few tuts for displacement, as I never really understood it^^. Just need little improvements for the thickness. Thank you newt.

  • newt: simple, but random. and it makes use of displacement, which is limited in resolution/steps. what did you advise, 60 polys or so?

    zyblade: if you really want to have that look, you had to create instances of line objects (maybe 5x5px or 3x3px sprites would be better considerung aa issues) and move/scale/rotate them via perlin as needed. that would be step/resoultion independent.

  • Hardware limitation is about 60x60, but there's not much reason to have as many rows as columns, 1 is fine. In which case you can go much higher in columns.

    I don't really suggest that though. Just divide the distance into equal parts that you are comfortable with.

    Also no reason you can't have multiple instances of the distortion.

  • Thanks for your replies,

    oppenheimer I'll already try that with the line object too, but it's proceeding slowly^^ If you don't mind, you could come up with a .cap.

    I looked a bit deeper into my first link. There are lines, connected to points, that are moveing relative from the last point up and down(if the last point got a little lower, the next (can) get even lower now until the main cap). And the points are even spread on the line(.width) how long it ever would be. And with at least 30 points, it looks very smooth. But I don't know (yet) how to replicate it because I don't know how to connect them relative to each other yet^^

  • For lines the method you would want to use is generate the random value to a variable, then use that variable for the end point, and also for the next start point.... generate random value to variable, etc.

    Also you might try Davids Ribbon object. It might be easier to use with distorts.

  • newt Yes, but how to make, with 1 line(many instances of it).

    How to pick the right one, because the 2nd start = the first end, the 3rd start = the 2nd end....a clever "for each" solution I think would be enough.

    I'll try that now, thanks.

  • Here I come:

    http://dl.dropbox.com/u/26932498/electric.cap

    I used r0j0hounds ribbon example as a base. I could use lines instead of, but for now, this is what I've got. The sprite is from the electric demo on the site as you maybe already recognized^^

    What I still need to do is:

    1) If I drag the last box, I need to rearrange the other ones relative to the first+last so it's again "one line".

    2) I want the y position of each point, beeing max distance to the next one = $variable(for example 50), so if the first one is on self.y + 45, the next one couldn't be self.y - 10 or lower. Because the max different is 50 and 45 - 50 = -5.

    If that works, it looks much better and not that...(insert adjective here)

    I hope my explanation was good enough, since I still need to improve my english ><

    edit: Just talked with tulamide and he says, it's possible with his splines: http://www.scirra.com/forum/advanced-interpolation-splines_topic49366.html. Since this math is a bit too high for me, maybe someone else knows?

    Normally I don't let the work do by other :/ really, but this is just too heavy^^.

  • Yep, the flash example uses splines, and you could achieve something similar with CC. But why doing all that work (and it is a lot of work) if there already is a nice looking solution using the ribbon object and distortion? <img src="smileys/smiley2.gif" border="0" align="middle" />

  • Yeah, spline would be almost like perlin, in that it would be a curve. You want the peaks, and jaggedness.

    Also if you go with a distortmap you wouldn't have to pick objects, you would just figure the coords.

    Like set columns to int(distance(sprite.x,sprite.y,sprite2.x,sprite2.y)/10)

    Then set the random xy's in a loop to lerp(sprite.x,sprite2.x,loopindex/distance(sprite.x,sprite.y,sprite2.x,sprite2.y)+normalrandom(0,64)

  • newt I don't know how where to put your formula exact, but thank you for all your help. Displacement and distorting maps is just a new challenge for me, I never worked with it and can't use your formula(yet). But I save it to my tutorial collection until I get further into it.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)