I have an old renderer from years ago written with OpenGL immediate mode. I've decided to learn Vulkan and I'm converting my old project as a way to learn the new concepts.

One of the things my old renderer did is display a 'glow' around a star that planets and other objects could pass through (see screenshot). This was done by using a greyscale texture and using some additive blending with colours - it created a nice effect.

I'm wondering if there's a modern/better looking technique that I can investigate to make this look even better 10 years on. It feels like something an 'ambient spherical volume light' around the sun could achieve, with the volume filled with fog?

I'm not sure if the approach I wrote makes any sense, just looking for ideas!

enter image description here


1 Answer 1


A simple spherical light volume can be computed as a post processing effect by drawing a cube with the face winding direction reversed (left hand winding vs right hand winding). This displays the interior of the cube. This gives a nice "halo" effect to lights.

Compute the intersection of a ray with a sphere that is fitted to the cube inside the fragment shader. The distance between the two intersection points are used to compute the halo's brightness. Usually the halo is assumed to have constant density so there is no ray casting just a straight forward sphere intersection.

Lastly, the depth buffer is used after computing the halo intersections to account for objects both inside, or in front of the halo.

  • $\begingroup$ Do you have any references to those techniques? I'd like to read some more. Thanks. $\endgroup$
    – BinaryGuy
    Commented Jul 22, 2021 at 3:23
  • $\begingroup$ I know there are papers on this but I can't find one. The book FGED2 has a write up with shader code though. $\endgroup$
    – pmw1234
    Commented Jul 22, 2021 at 10:59
  • $\begingroup$ Thanks for the book recommendation it looks great. If you remember the paper some time let me know! Thanks so much for your help. $\endgroup$
    – BinaryGuy
    Commented Jul 22, 2021 at 13:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.