Panda3D Manual: Common Image FiltersNote: Sorry, but the CommonFilters and FilterManager classes are implemented in Python and will not be of much use to C++ users.
Common Image FiltersNote: the following information applies to Panda version 1.5.0 and beyond. It does not apply to older versions of Panda3D. The purpose of class CommonFilters is to make it easy to set up a number of common image postprocessing operations. Import the class like this: from direct.filter.CommonFilters import CommonFilters Currently, the image postprocessing operations supported by class CommonFilters is:
We expect this list to grow rather substantially over the next year or so.
Basic SetupThe first step is to create an object of class CommonFilters. Pass in a pointer to your window, and your 3D camera: filters = CommonFilters(base.win, base.cam) This will have no effect until you enable a filter (instructions below.) Once a filter is enabled, class CommonFilters will reconfigure the Panda3D rendering as follows:
If all goes well, the net effect is that your scene will continue to appear in your window, but it will be filtered as you specify.
What if the Video Card can't handle it?If the video card is not capable of implementing your filters, then all filters will be removed and the filter-enabling function will return False. Otherwise, filter-enabling functions will return True.
The Bloom FilterThe bloom filter causes bright objects to have a glowing halo around them. To enable a bloom filter, use filters.setBloom( ... options ...) The bloom filter works as follows. First, it renders the scene into a texture. It also asks the renderer to render any glow-maps into the alpha channel of the texture. After rendering the scene, it generates a second copy of the scene which has been darkened until only the brightest pixels are visible, and all the others go to black. It then blurs that texture, yielding soft halos where the bright pixels used to be, and black everywhere else. It then adds the soft halos back onto the scene in the window. Note: If you want to use glow maps to indicate which parts of the image should receive bloom, you should assign a nonzero value to the alpha value of the blend-weight parameter, and you should enable the shader generator for the models that have glow maps applied. The bloom filter has many keyword parameters:
The Cartoon Inking FilterThe cartoon inking filter causes objects to have black lines around them. To enable a cartoon inking filter, use filters.setCartoonInk( ... options ...) The cartoon inking filter works by rendering a camera-space normal into an texture. Then, a postprocessing filter does an edge-detect algorithm on the camera-space normal texture. The filter has the following keyword parameters:
The Volumetric Lighting FilterThe Volumetric Lighting filter makes objects cast visible light rays (also known as crepuscular rays, god rays or sunbeams) that can be occluded by visible geometry. This is an easy way to easily create nice-looking light/sun effects. filters.setVolumetricLighting( ... options ...) The filter has the following keyword parameters:
The Inverted FilterThis filter simply inverts the colors of the image. filters.setInverted() This filter has no parameters.
The Blur / Sharpen FilterThis filter can apply a blur or sharpen effect to the image. filters.setBlurSharpen( ... options ...) The filter has the following keyword parameters:
The Ambient Occlusion FilterThis filter adds a simple screen-space ambient occlusion effect to the scene. filters.setAmbientOcclusion( ... options ...) It is important that the viewing frustrum's near and far values fit the scene as tightly as possible. Note that you need to do lots of tweaking to the parameters to get this filter to work for your particular situation. The filter has the following keyword parameters:
© Carnegie Mellon University 2010 |