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

Author Topic: White Highlight over a sprite using color multiplication  (Read 1825 times)

0 Members and 1 Guest are viewing this topic.

moistweb

  • Newbie
  • *
  • Posts: 18
    • View Profile
White Highlight over a sprite using color multiplication
« on: June 18, 2014, 02:25:25 pm »
Hello everyone,
in my Shmup game, and as every other Shmup games, enemies when getting hit tend to highlight in white for aesthetic purposes. I want to do the same, 'on the fly', without having to load a white version of the enemy sprite, that is, use color multiplication or some other technique. Unless the problem I found is that color multiplication doesn't produce a white color in the result. Any suggestions guys to achieve the result ?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: White Highlight over a sprite using color multiplication
« Reply #1 on: June 18, 2014, 02:34:48 pm »
Multiplication can only darken the result. Forget about it.

Your best solution is to use a pixel shader.
Laurent Gomila - SFML developer

moistweb

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: White Highlight over a sprite using color multiplication
« Reply #2 on: June 18, 2014, 02:47:15 pm »
Pixel shader ? what's that ? I'm sorry but I'm not familiar with shaders, do you have any article or tutorials I can start with ? thanks for your reply

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: White Highlight over a sprite using color multiplication
« Reply #3 on: June 18, 2014, 02:52:57 pm »
I'm pretty sure that the effect you are trying to achieve can be done with the new BlendModes that were recently implemented. Additive blending might do the trick, although you will have to tweak the blending parameters and source colours.

But as Laurent already said, nothing beats using shaders ;) although they might be a bit overkill for this application if using standard blending can work as well.
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

moistweb

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: White Highlight over a sprite using color multiplication
« Reply #4 on: June 18, 2014, 07:32:01 pm »
Thanks binary1248 I will search further on the topics you mentioned they seem interesting

 

anything