2
$\begingroup$

For a real-time application I am trying to add glow to a few hundred points. These points are more like 2D circles of various small sizes on the screen.

These points are supposed to be like balls of light so it makes sense that they should glow and that it should be very bright when multiple are in proximity.

These points are sometimes as small as 4 pixels so they can easily disappear in lower resolutions. Previously I have done this using convolutions (gaussian blur) and have employed a variety of processes to speed things up.

  • Separate vertical and horizontal passes
  • Taking advantage of bilinear sampling
  • Doing the blur at a lower resolution
  • Using Metal's special kernel for it

However none of these performs quite well enough. They are ok but I want to try to push further. A few ways these methods all fail are the following

  • If the points cluster or overlap it doesn't look too bright. They are completely opaque and so even with additive blending it doesn't work.
  • I have to have a lower radius of blur than I would like as I tradeoff quality for blur distance.

What I am looking for is to see if there are any techniques that I might be able to replace these with or add to them. One thought has been spatial data structures. I thought about splitting up the space with a BSP and then coloring squares based on how deep into the tree that square is and how many points it has in it. This has issues for the following reasons.

  • I don't feel like a BSP algorithm translates nicely to GPUs
  • Points on the edge of multiple partitions would be poorly represented
  • How do you even visualize on a GPU how many points are within each partition in a binary tree

Do you think any part of this algorithm would translate well to GPUs?

I am ok with it looking square because I can blur that or just blend it in with the existing blur.

Can you think of any sorts of algorithms that might help me achieve my two goals

  • A bunch of points clustered close together have an aura that is very far reaching and looks brighter than just one point.
  • General portions of the screen where a lot of points are are a bit brighter
$\endgroup$
  • $\begingroup$ Sounds like you are talking about point lights. If you used a deferred rendering technique you could pass all the point positions and brightness as an array of uniforms and render them on the screen in a single pass $\endgroup$ – zoran404 May 1 at 9:27

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.