SFML community forums
Help => Graphics => Topic started by: nathanmyersc on October 07, 2021, 02:09:21 pm
-
How do i make it so the vertex color is only applied to non 0 alpha pixels?
Because when i have the vertex quad textured and i want to fade it out.
I modify all the vertex's color parameter for alpha. But this makes all the pixels
within the quad the same alpha. regardless if some where transparent in the first place.
How do i solve this?
-
This should actually behave as you expect - the vertex colours are multiplied (after being normalised) with the texture colours. So a vertex alpha of 0.5 (127) should make a texture colour alpha 0.5 (if it started as 1 aka 255), 0.25 if it was 0.5 and so on. If the alpha of the texture is already 0 it should remain so (0 * 0.5 == 0).
Are you using the correct blend mode, which should be sf::BlendAlpha?
Sharing some of your code might also help