I'm looking for a clean way of making sprites that look like the following glowing circle, except in any arbitrary colour.

enter image description here

Originally we thought we could start with a gray-scale version of the above image (shown below) and then use the tint parameter in spriteBatch.Draw to change the colour of the glow.

enter image description here

The problem is that because spriteBatch.Draw uses multiplicative blending to blend the tint and the colour the white parts don't stay white, they become the colour of the tint. The next image shows (approximately) what this looks like.

enter image description here

The other solution we thought of is to have two separate sprites, a white interior and a grayscale glow, and then we apply the tint to the glow and draw that on top of the white interior. This produces the desired effect (to a degree) but is annoying on our part since it requires is to double all the sprites we want to draw this way.

Is there any other cleaner solution that produces the desired effect for an arbitrary colour?

  • \$\begingroup\$ This sounds like premature optimisation. Have you profiled twice the sprites and found them to be too slow? \$\endgroup\$ – Anko May 3 '15 at 13:23
  • \$\begingroup\$ It's not that it's slow, it probably doesn't affect the speed at all in fact, it's just annoying to have to make twice as many sprites as normal. We're planning on having about 50 sprites that need to be drawn this way, and if we separated them into a glow and an interior that would be 100. We were just wondering if there's an easier way. \$\endgroup\$ – user3002473 May 3 '15 at 14:32
  • 1
    \$\begingroup\$ Actually, there does seem to be some drop in efficiency. On screen at once there are between 1000 and 4000 of these sprites, and the majority of the computation time with one sprite was spent drawing them, so with two sprites we'd have to halve the cap to 2000, which we don't want to do. \$\endgroup\$ – user3002473 May 3 '15 at 14:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.