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

Author Topic: Max and Min blending mode  (Read 11812 times)

0 Members and 1 Guest are viewing this topic.

Sakarah

  • Newbie
  • *
  • Posts: 2
    • View Profile
Max and Min blending mode
« on: March 07, 2021, 03:46:37 pm »
The enumeration sf::BlendMode::Equation contains only three constants. But as far as I know, OpenGL implementations that support Subtract also support Max and Min.
An old thread said that there were no use for Min and Max BlendMode equations. However, I strongly disagree with that statement as my current project rely on the Max blending mode.

Indeed, I want to make an 2D infiltration game, where some agents (say cameras) have a viewing score for each pixel in their range. When two or more of these cameras view the same zone, the viewing score of a pixel is the maximum score of each camera.
I want the player to visualize these viewing zones, and for that I plan to draw a viewing zone for each camera and rely on the blending mode to actually retain the maximum value.

Speaking about Min, if I hypothetically wanted to instead draw safeness of a given pixel I would like each camera to locally decrease safeness of its neighboring pixels, and remember the minimal safeness value instead of the maximum.

Obviously, I can fork SFML for my current project to fulfill my needs, but I really think that Max and Min blending modes can be useful for others, and their implementation in the library is trivial (around 15 LoC).

If I submit a pull request to add Min and Max blending mode, would you accept it ?
« Last Edit: March 07, 2021, 03:49:04 pm by Sakarah »

 

anything