1
\$\begingroup\$

I am Drawing a lightning effect animation using this image:

im3

Below the result:

img1

img2

As you can see the outcome is not a continuous purple color as I wanted it to be, but it has black spaces in between some parts. The way i am drawing this animation is that i am drawing two LightningBolts every frame in Additive mode. Every LightningBolt is drawn with the help of 21 random points across the width of the animation which makes 20 lines of various angles. So I rotate the texture I have to match each angle I calculated for each of those 20 lines for the two LightningBolts I am drawing in every frame in Additive mode.

What are your suggestions to overcome this problem ?

\$\endgroup\$
  • \$\begingroup\$ A quick idea would be to use the QUAD_STRIP primitive, as seen here. \$\endgroup\$ – Alexandre Desbiens Jun 18 '15 at 16:50
  • \$\begingroup\$ @AlexandreDesbiens In the end what I did was to skew instead of rotate. But that's an interesting idea. \$\endgroup\$ – dimitris93 Jun 18 '15 at 18:56
  • \$\begingroup\$ That was my point about the QUAD_STRIP, it does that automatically. But I'm glad you found a solution to your problem. Feel free to create an answer and accept it if you are done. \$\endgroup\$ – Alexandre Desbiens Jun 18 '15 at 18:57
  • \$\begingroup\$ @AlexandreDesbiens Oh I thought you meant I would have to fill the gaps that way. The reason I didn't add this as an answer is because skew in XNA is really expensive (especially for a particle system like this one) and it needs to be done with a dynamic vertex buffer for performance which I haven't done yet. \$\endgroup\$ – dimitris93 Jun 18 '15 at 19:01
  • 1
    \$\begingroup\$ See this image, you will understand. \$\endgroup\$ – Alexandre Desbiens Jun 18 '15 at 19:02
1
\$\begingroup\$

Do not change the rotation. Change the y-position instead.

Another completely different approach which will look far better but might be far slower would be to draw the white core part of the lightning as a randomized path of line segments and then add the magenta halo in post-processing by taking the bolt, applying gaussian blur, removing the green channel (to make in magenta) and draw the blur first and the original bolt second.

\$\endgroup\$
0
\$\begingroup\$

Never done anything like that, but as an sugestion: what about the to draw the circle with gradient on each point between lighting parts? This will make the edges smooth, that might not be very much like a real lightning, but no ragged edges.

\$\endgroup\$
  • \$\begingroup\$ draw which circle ? \$\endgroup\$ – dimitris93 Jan 19 '15 at 8:18
  • \$\begingroup\$ do you know if instead of rotating the texture, if i can draw it like this i.imgur.com/N2SId7I.png ? that would solve the problem \$\endgroup\$ – dimitris93 Jan 19 '15 at 8:21
  • \$\begingroup\$ opened a question asking this: gamedev.stackexchange.com/questions/92499/… \$\endgroup\$ – dimitris93 Jan 19 '15 at 9:55
  • \$\begingroup\$ Sorry, can not add comment in second question. In the example, which have Peethor is precisely those same circles or rather halfcircles who need to draw on the joints. In the example, which have Peethor is precisely those same circles or rather polukruki who need to draw on the joints and they smooth them. On the result lighting they are looks like bright spots. \$\endgroup\$ – user52551 Jan 19 '15 at 10:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.