Pseudo-Volumetric Point Lights; Magic Behind Trapcode Lux
In the After Effects world, Trapcode has become synonymous with particle effects and shiny light rays. But, my favorite plugin has always been Trapcode Lux. I like how it creates volumetric looking light effects in After Effects and auto-detects the lights in the composition. As long as my work is confined to After Effects, I had no problem, but once I have started working in other programs and languages, I desperately needed something that has the functionality of Trapcode Lux. I was working on a real time project in Processing, and I really wanted to add ‘Lux’ to my lights. So, I started observing the plugin closely and here are my thoughts on it. These are just my observations, nothing official.
- The plugin places Sprites in the location of every point light.
- The texture and the dimensions of the sprite are dynamic.
- Most importantly, there is no blurring involved.
- It is Camera aware; Sprites always face the camera. It confirms that there are no real volumetrics involved.
- The texture of the sprite looks like a radial gradient, but a lot more exponential.
So, I was pretty sure, the plugin uses some function to calculate the radial ‘gradient like’ texture. It turns out, the function is nothing but a Point Light function. I am not sure about the exact formula used for the plugin, but the general point light formula for an image plane goes something like this. (Don’t panic, I too found this after googling for a while!). There is also a Pixel Bender kernel that implements this.
Attenuation = [multFactor/distance(location-lightpos)^decay]^brightness
Now, to explain it in visual terms, Lux takes the locations of all the lights and places a sprite in each location. Then, it also places an identical light at each location at a certain distance away from the sprite and perpendicular to it. So , that creates a point light like effect at every location. Finally it blends all of the sprites together, and then implements a Camera Matrix. The same principal applies to Spot Lights too, but the anchor points and other parameters for spot lights make this process a little bit more tricky.
Now, take a look at the following interactive Java applet. The vertical position of the mouse affects the distance of each point light from the plane in a direction perpendicular to the plane and towards the viewer. You can clearly see at a certain distance from the plane, the lights look exactly like the point light effect generated by Lux.
I just used the same technique to create this effect in After Effects, which I explained in this tutorial.
Now, I don’t recommend this as an alternative to Trapcode Lux for daily use. But, it might help you if are not capable of buying Lux or working on a platform other than After Effects, but still Lux is an amazing plugin that takes away a lot of dirty work from your hands to create this effect.
In conclusion, I highly appreciate Mr.Norrby’s concept on creating this effect. I am not sure if it is implemented before, but irrespectively it is definitely genius thinking on his part.