Spotlight Pixel Bender Filter
This is an advanced filter which renders dynamic colored lighting on a display object in Flash. Consider it a work in progress — It's not as full featured as Photoshop's "Lighting Effects" filter, but it is capable of creating a wide array of effects. The kernel's main algorithm was ported from NVIDIA's Shader Library, but I had to make some pretty heavy modifications to make it more functional for the Flash world. It has 8 parameters: ambientColor, angle, azimuth, coneAngle, distance, intensity, position, and spotColor.
- ambientColor - color to apply to all pixels of the image
- angle - angle at which the spotlight is projected (in degrees)
- azimuth - angle between the image plane and the spotlight (in degrees)
- coneAngle - angle of the spotlight's "opening" (in degrees)
- distance - distance from the spotlight to the center point
- intensity - intensity of the spotlight
- position - x, y, z position of the spotlight
- spotColor - color of the spotlight
There are so many different ways that you could use this effect, I will probably devote a few more posts to showing additional examples. In this demo, I created a couple of draggable handles that you can use for positioning the spotlight, and some preset configurations (try the dawn, day, and dusk buttons). Next time, I'll incorporate some animation.
About this entry
You’re currently reading “Spotlight Pixel Bender Filter,” an entry by Ryan Phelan
- Published:
- 10.28.08 / 10am
- Category:
- Flex, Pixel Bender






8 Comments
Jump to comment form | comments rss [?] | trackback uri [?]