Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Particles, Bluring  (Read 6953 times)

0 Members and 1 Guest are viewing this topic.

fr33k

  • Newbie
  • *
  • Posts: 16
    • View Profile
Particles, Bluring
« on: July 29, 2014, 07:38:27 pm »
Hello,
I want to ask about bluring/texturing particles based on sf::VertexArray (sf::Quads).
To blur particle, I must draw it on sf::RenderTexture, and draw all using sprite with blur shader ?
... or there's another way ?
In sfml tutorials we can find one about particles:
http://sfml-dev.org/tutorials/2.1/graphics-vertex-array.php
But in youtube I see something like that:

I tried to texture quad like in tutorial, and:
One quad = one pixel from texture, then to have textured particles like in Unity, I have to create as many quads as texture have to create one big, textured particle ?

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: Particles, Bluring
« Reply #1 on: July 29, 2014, 08:46:34 pm »
The video doesn't necessarily use shaders. You can achieve those effects by playing around with the blend mode, scale and alpha value of particles.

If you don't want to reinvent the wheel, I have done all of this in Thor. The example provided in the SDK is very similar to that video. There's also one for fireworks :)
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

fr33k

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: Particles, Bluring
« Reply #2 on: July 29, 2014, 09:15:14 pm »
What about SPARK ?
http://en.sfml-dev.org/forums/index.php?topic=829.msg6118#msg6118
On the demo, we can see fire particles:
http://oi61.tinypic.com/104ntc4.jpg
It's an texture, but how can I make something like that ?
I want quad particles, which I can texture like that, when it's needed.
What should I use ?
« Last Edit: July 29, 2014, 09:27:02 pm by fr33k »

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: Particles, Bluring
« Reply #3 on: July 29, 2014, 09:23:49 pm »
It seems like SPARK has not been updated for several years, their original website is also down. But if it works with SFML 2, you can of course also use it!

In case you decide to go with Thor, you could read the official tutorial, the API documentation and have a look at the two example codes... After that, you're definitely ready to start with your own particles ;)
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

fr33k

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: Particles, Bluring
« Reply #4 on: July 29, 2014, 09:25:13 pm »
Oh, but i don't want to use anything.  ;)
I knowed about thor long ago, but I want to create particle system by myself.
And like I wrote:
Quote
On the demo, we can see fire particles:
http://oi61.tinypic.com/104ntc4.jpg
It's an texture, but how can I make something like that ?
I want quad particles, which I can texture like that, when it's needed.
What should I use ?

EDIT: It's can be something like that too:

Quads + perlin noise and blur.
« Last Edit: July 29, 2014, 09:32:36 pm by fr33k »

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: Particles, Bluring
« Reply #5 on: July 30, 2014, 07:15:17 am »
Why do you ask for SPARK then? ???

In any case, you can also have a look at Thor's implementation. You should probably just start experimenting, a simple particle system (even based on sprites for prototyping) is written within a few minutes. You can then continuously add features, but don't try to do all at once if this is the first time you're using particles.
« Last Edit: July 30, 2014, 07:16:58 am by Nexus »
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

fr33k

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: Particles, Bluring
« Reply #6 on: July 30, 2014, 10:57:07 am »
Quote
Why do you ask for SPARK then? ???
It was just example.  :)
Ok, thanks I'll take a look at Thor.
I created a particle system, based on sf::Quads, but I wanted to know, how can I blur my particles like in yt viedo, or texture it. I'm asking, beacuse when I draw my particles with Gaussian Blur shader, my quads are just vanishing. When I texture it, one quad is one pixel so to create something like on the screen:
http://oi61.tinypic.com/104ntc4.jpg
I must to create width*height*4 vertices for one big textured particle, right ?
Generally, I want to have two options. Texture particle, and create an effect with that, or just lay on particles an shader (for example blur, like in this video: ).
So to create (textured) particle system based on vertices, is something like texture_width*texture_height*4*particle_count vertices a good idea ? That's my final question.  And it's not my first time, when I'm using particles, but I've never tried to create any particle system by myself.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Particles, Bluring
« Reply #7 on: July 30, 2014, 11:11:43 am »
The particles shown in these videos / screenshots are textured quads, most of the visual result is obtained by simply choosing a suitable texture.

If you have troubles texturing your quads, post some code so that we can help you. Make sure you have read the tutorial about vertex arrays, it explains everything and has examples (the tilemap example shows how to texture quads).
Laurent Gomila - SFML developer

fr33k

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: Particles, Bluring
« Reply #8 on: July 30, 2014, 11:41:39 am »
I read the tutorial again but more precisely, and:
Okay... sorry for my stupidity.  ::)
Now it's working, as should  :D. Sorry for taking your valuable time.
Now I can create simple particle system for my games.  ;D
Thanks, and have a good day.  ;)