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

Author Topic: Anisotropic Filtering  (Read 14095 times)

0 Members and 1 Guest are viewing this topic.

oomek

  • Jr. Member
  • **
  • Posts: 90
    • View Profile
    • Email
Anisotropic Filtering
« on: March 28, 2018, 04:39:43 pm »
I’m experimenting with adding anisotropic filtering to SFML, but I’m not certain what would be the best approach. I could add a function setAnisotropicLevel(int level) to the sf::Texture class so it needs to be set for every texture with mipmap, or make it global setting and it would modify the setSmooth() function in a way that every texture with mipmap would have anisotropic filtering enabled instead of bilinear.  What do you think?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Anisotropic Filtering
« Reply #1 on: March 28, 2018, 04:58:48 pm »
What are use cases for this?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

oomek

  • Jr. Member
  • **
  • Posts: 90
    • View Profile
    • Email
Re: Anisotropic Filtering
« Reply #2 on: March 28, 2018, 05:41:17 pm »
I believe I’ve already explained it somewhere on github. Anyway, when you scale the texture with mipmap non-isotropically the quality degrades exponentially as the mipmap sampling level adapts to the smaller dimension. So the texture 100x100 scaled to 100x10 will look like scaled down to 10x10 and interpolated to 100x10
« Last Edit: March 28, 2018, 06:04:06 pm by oomek »

oomek

  • Jr. Member
  • **
  • Posts: 90
    • View Profile
    • Email
Re: Anisotropic Filtering
« Reply #3 on: March 28, 2018, 06:13:09 pm »
Would you like a sample video?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Anisotropic Filtering
« Reply #4 on: March 28, 2018, 06:30:05 pm »
That's certainly also a way to show what's the use case. We're also interested in high-level reasonings why this should be part of SFML, how it fits into the SFML scope, etc
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

oomek

  • Jr. Member
  • **
  • Posts: 90
    • View Profile
    • Email
Re: Anisotropic Filtering
« Reply #5 on: March 28, 2018, 06:47:46 pm »
Without anisotropic filtering mipmapped sprites look awful when you scale them down only in one axis.

oomek

  • Jr. Member
  • **
  • Posts: 90
    • View Profile
    • Email
Re: Anisotropic Filtering
« Reply #6 on: March 28, 2018, 07:05:10 pm »
I don’t know if this is enough or you want me to explain the practical use of scaling the images in one direction :)

oomek

  • Jr. Member
  • **
  • Posts: 90
    • View Profile
    • Email
Re: Anisotropic Filtering
« Reply #7 on: March 28, 2018, 09:32:03 pm »
Here is the video explaining why we should have anisotropic filtering when mipmaps are used.


oomek

  • Jr. Member
  • **
  • Posts: 90
    • View Profile
    • Email
Re: Anisotropic Filtering
« Reply #8 on: March 28, 2018, 11:43:53 pm »
So, what do you think? Do I have a green light?

oomek

  • Jr. Member
  • **
  • Posts: 90
    • View Profile
    • Email
Re: Anisotropic Filtering
« Reply #9 on: March 29, 2018, 02:33:37 pm »
Seems not :/

aggsol

  • Newbie
  • *
  • Posts: 24
  • C++
    • View Profile
    • My Github Account
Re: Anisotropic Filtering
« Reply #10 on: March 29, 2018, 03:15:24 pm »
Seems not :/

Just wait and be patient, this is no real time chat or twitter. People have jobs and lives and coming weekend is easter.

oomek

  • Jr. Member
  • **
  • Posts: 90
    • View Profile
    • Email
Re: Anisotropic Filtering
« Reply #11 on: March 29, 2018, 03:20:33 pm »
You have to forgive me. I’m disabled and housebound, so the time passes at a different pace to me as to others.

aggsol

  • Newbie
  • *
  • Posts: 24
  • C++
    • View Profile
    • My Github Account
Re: Anisotropic Filtering
« Reply #12 on: March 29, 2018, 03:30:13 pm »
You have to forgive me. I’m disabled and housebound, so the time passes at a different pace to me as to others.

np  ;) I am glad to see more pople being enthusiastic about SFML. Kepp up the good work in any case.

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: Anisotropic Filtering
« Reply #13 on: March 30, 2018, 01:26:47 pm »
I imagine this could have some applications in certain use cases.
  • Textured GUIs generated on-the-fly from structural descriptions
  • Procedurally generated artwork, think grammar-based building façades etc.
  • ...
Since I don't imagine this being such a big change, and it will enable new ways of using the library and more artistic freedom, you could submit an initial pull request. Whether you discuss the necessary modifications to the public API here or in the PR comments is up to you.
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Anisotropic Filtering
« Reply #14 on: March 30, 2018, 02:07:14 pm »
What would be the reason(s) to not use it by default then? Compatibility? Performances?
Laurent Gomila - SFML developer