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

Author Topic: Framerate and vertex array  (Read 1325 times)

0 Members and 1 Guest are viewing this topic.

SukauGrandi

  • Newbie
  • *
  • Posts: 4
    • View Profile
Framerate and vertex array
« on: March 29, 2017, 01:34:58 pm »
Hey peeps!

I have a quite general question about framerate and usage of vertexarray to draw quads.

So, basically, I have a working particle engine. I noticed that, when generating particles,framerate gets better the tigther the particles are together. That means that if i create a particle emitter that draws 400+ quads ( with vertex array ) on a single spot all the time with BlendAdd, i get around 60 fps (just an example value), but if i draw the same particles spread over the whole screen with the same setting, I get around 40 fps.

So I am wondering if someone knows the more fundamental details of how SFML handles drawing with Blend Add e.t.c. For me it makes sense that when drawing particles tighter together, the framerate should be lower, not other way around since you then have more quads that need to be blended together at one area.

So in a more general sense, when designing particle effects in game with performance in mind, what are the tips? (besides less particles in total ofc)

- Less spread ?

or

- More spread ?

From your experience, how does size of the particles affect it all?

And why exactly?

kramitox

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • Email
Re: Framerate and vertex array
« Reply #1 on: April 06, 2017, 08:52:16 am »
From my experience in openGL, the main memory drainage you would be having is the fact you are using quads instead of triangles. Most graphics cards can draw 2 triangles much faster then they can draw a quad. So try this and hopefully you can get better particles. Your next approach should then be to learn how to use Instancing in openGL.
Instancing pretty much cuts out some of the grunt work. Currently by every draw frame you are sending info to the graphics card for each particle. With instancing you send information about a single particle and then you can use your vertx shaders to manipulate it. Its your best option for rendering particles.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Framerate and vertex array
« Reply #2 on: April 06, 2017, 10:46:15 am »
A quad is just two triangles, so that doesn't matter.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/