Shiny lights with flare in OpenGL

Alec Jacobson

October 21, 2013

weblog/

I ripped apart this OpenGL demo to add a few C++ functions to our libigl library for rendering shiny lights with lens flare. In version ≥ 0.3.5, check out the example in examples/flare-eyes. This all began because I wanted to render small lights (like LEDs) into my OpenGL scene. I first tried just showing little brightly colored circles.

beast with colored circles for eyes

But this is (un)imaginably lame.

Turns out to make something really look like a shiny light you need a bit more. I didn't want to go as far as physically-based rendering or even screen space post-processing. Rather I opted for a simple pure openGL approach with textures. I use the glDepthMask(GL_FALSE) to be sure that the layers of textures I paint for each shiny light correctly hid behind seen objects but don't occlude anything or each other. This gives a rather nice, and cheap, effect:

beast with shiny lights with flare for eyes