Implementing volumetric lighting using the half-angle slicing

In this recipe, we will implement volumetric lighting using the half-angle slicing technique. Instead of slicing the volume perpendicular to the viewing direction, the slicing direction is set between the light and the view direction vectors. This enables us to simulate light absorption slice by slice.

Getting ready

The code for this recipe is in the Chapter7/HalfAngleSlicing directory. As the name suggests, this recipe will build up on the 3D texture slicing code.

How to do it…

Let us start this recipe by following these simple steps:

  1. Setup offscreen rendering using one FBO with two attachments: one for offscreen rendering of the light buffer and the other for offscreen rendering of the ...

Get OpenGL – Build high performance graphics now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.