direct.filter.CommonFilters

from direct.filter.CommonFilters import CommonFilters, FilterConfig

Class CommonFilters implements certain common image postprocessing filters.

It is not ideal that these filters are all included in a single monolithic module. Unfortunately, when you want to apply two filters at the same time, you have to compose them into a single shader, and the composition process isn’t simply a question of concatenating them: you have to somehow make them work together. I suspect that there exists some fairly simple framework that would make this automatable. However, until I write some more filters myself, I won’t know what that framework is. Until then, I’ll settle for this clunky approach. - Josh

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]
delGammaAdjust(self)[source]
delHalfPixelShift(self)[source]
delInverted(self)[source]
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]
setBlurSharpen(self, amount=0.0)[source]

Enables the blur/sharpen filter. If the ‘amount’ parameter is 1.0, it will not have 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]
setGammaAdjust(self, gamma)[source]

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

setHalfPixelShift(self)[source]
setInverted(self)[source]
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