<p>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 &quot;halo&quot; effect to lights.</p>
<p>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.</p>
<p>Lastly, the depth buffer is used after computing the halo intersections to account for objects both inside, or in front of the halo.</p>

CC BY-SA 4.0
2021-07-22T03:23:14.933Z
Do you have any references to those techniques? I'd like to read some more.  Thanks.
BinaryGuy
CC BY-SA 4.0
2021-07-22T10:59:38.063Z
I know there are papers on this but  I can't find one. The book FGED2 has a write up with shader code though.
pmw1234
CC BY-SA 4.0
2021-07-22T13:18:54.140Z
Thanks for the book recommendation it looks great. If you remember the paper some time let me know! Thanks so much for your help.
BinaryGuy
CC BY-SA 4.0
2021-07-21T12:09:18.440Z
2021-07-21T12:09:18.440Z
pmw1234
<p>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.</p>
<p>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.</p>
<p>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?</p>
<p>I'm not sure if the approach I wrote makes any sense, just looking for ideas!</p>
<p><a href="https://i.sstatic.net/kT6Cz.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/kT6Cz.jpg" alt="enter image description here" /></a></p>

<opengl><lighting><volumetric>
Techniques to implement a glow that encompasses a volume
BinaryGuy
# Techniques to implement a glow that encompasses a volume

(Asked by: username_0 on 2021-07-21)

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](https://i.sstatic.net/kT6Cz.jpg)](https://i.sstatic.net/kT6Cz.jpg)

**Tags:** opengl, lighting, volumetric


---

## 1 answers

### Answer by username_1 on 2021-07-21. Score: 3 | Accepted answer

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.

> **Comments:**
> **username_0**: Do you have any references to those techniques? I'd like to read some more.  Thanks.  
> **username_1**: I know there are papers on this but  I can't find one. The book FGED2 has a write up with shader code though.  
> **username_0**: Thanks for the book recommendation it looks great. If you remember the paper some time let me know! Thanks so much for your help.  

---

