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

Author Topic: Is it possible to 'lower' sprite LOD before drawing  (Read 3160 times)

0 Members and 1 Guest are viewing this topic.

Insentience

  • Newbie
  • *
  • Posts: 10
    • View Profile
Is it possible to 'lower' sprite LOD before drawing
« on: May 18, 2014, 09:03:59 pm »
Disclaimer: I don't really know what I'm talking about

When I zoom my sf::View outwards, more sprites are drawn and subsequently the fps drops like an anvil. Is it possible for me to set my sprites to draw at a 'lower' level of detail, speeding up the process of drawing everything?

Thanks

EDIT: Would mipmapping be the only solution?
« Last Edit: May 18, 2014, 09:07:21 pm by Insentience »

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: Is it possible to 'lower' sprite LOD before drawing
« Reply #1 on: May 18, 2014, 09:07:27 pm »
The limiting factor in performance is usually not the number of pixels being drawn, but the number of draw calls. So, using a lower LOD won't really help. It's a bit different in 3D where LOD determines the number of polygons.

What you can do is use sf::VertexArray instead of sf::Sprite to draw multiple entities at once.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Insentience

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: Is it possible to 'lower' sprite LOD before drawing
« Reply #2 on: May 18, 2014, 10:19:20 pm »
Using a vertex array like this would require that all of the spirtes share a common texture, correct?

What if, by condensing everything into a single tile sheet, the texture ended up really really big? Wouldn't that be bad?

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: Is it possible to 'lower' sprite LOD before drawing
« Reply #3 on: May 18, 2014, 10:24:41 pm »
Yes. You can find a trade-off between texture size and number of draw calls. Even if you end up with a dozen vertex arrays, that's still nothing.

Out of curiosity: how many objects are visible at the same time? And you do manually exclude the invisible ones, don't you?
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Insentience

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: Is it possible to 'lower' sprite LOD before drawing
« Reply #4 on: May 18, 2014, 11:04:04 pm »
Yes. You can find a trade-off between texture size and number of draw calls. Even if you end up with a dozen vertex arrays, that's still nothing.

Out of curiosity: how many objects are visible at the same time? And you do manually exclude the invisible ones, don't you?
There isn't a set number of objects appearing on the screen at the same time. And of course I do, I'm using a quadtree

I'm not that clueless  :P

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: Is it possible to 'lower' sprite LOD before drawing
« Reply #5 on: May 18, 2014, 11:47:22 pm »
There isn't a set number of objects appearing on the screen at the same time.
Okay, I only thought about the rough order of magnitude. If you have really many objects (millions or so), some kind of LOD might still be appropriate, but then I'd rather go in the direction of sf::RenderTexture. You would then save areas that don't change in a specific resolution and re-render them as one sprite.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Insentience

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: Is it possible to 'lower' sprite LOD before drawing
« Reply #6 on: May 19, 2014, 02:28:45 am »
Well, it's not in the millions. Thanks for the help

jannugimes

  • Guest
Re: Is it possible to 'lower' sprite LOD before drawing
« Reply #7 on: May 19, 2014, 09:02:08 am »
There isn't a set number of objects appearing on the screen at the same time.
Okay, I only thought about the rough order of magnitude. If you have really many objects (millions or so), some kind of LOD might still be appropriate, but then I'd rather go in the direction of sf::RenderTexture. You would then save areas that don't change in a specific resolution and re-render them as one sprite.

Great and very helpful answer also for me.

 

anything