direct.filter.CommonFilters

from direct.filter.CommonFilters import CommonFilters, FilterConfig

Class CommonFilters implements certain common image postprocessing filters. See the Common Image Filters page for more information about how to use these filters.

These filters are written in the Cg shading language.

Inheritance diagram

Inheritance diagram of direct.filter.CommonFilters

class CommonFilters(win, cam)[source]

Bases: object

Class CommonFilters implements certain common image postprocessing filters. The constructor requires a filter builder as a parameter.

__init__(self, win, cam)[source]
cleanup(self)[source]
delAmbientOcclusion(self)[source]
delBloom(self)[source]
delBlurSharpen(self)[source]
delCartoonInk(self)[source]
delExposureAdjust(self)[source]
delGammaAdjust(self)[source]
delHalfPixelShift(self)[source]
delHighDynamicRange(self)[source]
delInverted(self)[source]
delMSAA(self)[source]
delSrgbEncode(self)[source]

Reverses the effects of setSrgbEncode.

delViewGlow(self)[source]
delVolumetricLighting(self)[source]
reconfigure(self, fullrebuild, changed)[source]

Reconfigure is called whenever any configuration change is made.

setAmbientOcclusion(self, numsamples=16, radius=0.05, amount=2.0, strength=0.01, falloff=2e-06)[source]
setBloom(self, blend=(0.3, 0.4, 0.3, 0.0), mintrigger=0.6, maxtrigger=1.0, desat=0.6, intensity=1.0, size='medium')[source]

Applies the Bloom filter to the output. size can either be “off”, “small”, “medium”, or “large”. Setting size to “off” will remove the Bloom filter.

setBlurSharpen(self, amount=0.0)[source]

Enables the blur/sharpen filter. If the ‘amount’ parameter is 1.0, it will not have any effect. A value of 0.0 means fully blurred, and a value higher than 1.0 sharpens the image.

setCartoonInk(self, separation=1, color=(0, 0, 0, 1))[source]
setExposureAdjust(self, stops)[source]

Sets a relative exposure adjustment to multiply with the result of rendering the scene, in stops. A value of 0 means no adjustment, a positive value will result in a brighter image. Useful in conjunction with HDR, see setHighDynamicRange.

New in version 1.10.7.

setGammaAdjust(self, gamma)[source]

Applies additional gamma correction to the image. 1.0 = no correction.

setHalfPixelShift(self)[source]
setHighDynamicRange(self)[source]

Enables HDR rendering by using a floating-point framebuffer, disabling color clamping on the main scene, and applying a tone map operator (ACES).

It may also be necessary to use setExposureAdjust to perform exposure compensation on the scene, depending on the lighting intensity.

New in version 1.10.7.

setInverted(self)[source]
setMSAA(self, samples)[source]

Enables multisample anti-aliasing on the render-to-texture buffer. If you enable this, it is recommended to leave any multisample request on the main framebuffer OFF (ie. don’t set framebuffer-multisample true in Config.prc), since it would be a waste of resources otherwise.

New in version 1.10.13.

setSrgbEncode(self, force=False)[source]

Applies the inverse sRGB EOTF to the output, unless the window already has an sRGB framebuffer, in which case this filter refuses to apply, to prevent accidental double-application.

Set the force argument to True to force it to be applied in all cases.

New in version 1.10.7.

setViewGlow(self)[source]
setVolumetricLighting(self, caster, numsamples=32, density=5.0, decay=0.1, exposure=0.1, source='color')[source]
update(self, task=None)[source]

Updates the shader inputs that need to be updated every frame. Normally, you shouldn’t call this, it’s being called in a task.

class FilterConfig[source]

Bases: object