本文整理汇总了Python中PostProcessing.Effect类的典型用法代码示例。如果您正苦于以下问题:Python Effect类的具体用法?Python Effect怎么用?Python Effect使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Effect类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: blur
def blur(filterMode = 0, attenuation = (1, 1, 1, 1), numPasses = 1, width = 1.0):
"""This method creates and returns a blur post-process effect. It assumes
the scene has been captured and downsampled into the downSample3 render target."""
downSample3 = rt('PostProcessing/downSample3')
computeBuffer1 = rt('PostProcessing/computeBuffer1')
computeBuffer2 = rt('PostProcessing/computeBuffer2')
phases = []
if numPasses > 0:
bh = buildBlurPhase(downSample3.texture, computeBuffer1, True, filterMode, width)
bh.material.attenuation = attenuation
bv = buildBlurPhase(computeBuffer1.texture, computeBuffer2, False, filterMode, width)
phases.append(bh)
phases.append(bv)
if numPasses > 1:
bh = buildBlurPhase(computeBuffer2.texture, computeBuffer1, True, filterMode, width)
bh.material.attenuation = attenuation
bv = buildBlurPhase(computeBuffer1.texture, computeBuffer2, False, filterMode, width)
for n in xrange(1, numPasses):
phases.append(bh)
phases.append(bv)
t = buildTransferPhase(computeBuffer2.texture, BW_BLEND_SRCALPHA, BW_BLEND_ZERO)
phases.append(t)
e = Effect()
e.name = 'Blur'
e.phases = phases
return e
示例2: posteriseAndEdge
def posteriseAndEdge():
"""This method creates and returns a post-process effect that posterises
the back buffer and draws black edges. It does this by using a Kuwahara
filter, which is a noise-reduction filter that preserves edges. It then
performs edge detection and dilation and blends the results back over the
posterised back buffer."""
backBufferCopy = rt('PostProcessing/backBufferCopy')
backBufferCopyB = rt('PostProcessing/backBufferCopyB')
downSample1 = rt('PostProcessing/downSample1')
downSample1B = rt('PostProcessing/downSample1B')
c = buildBackBufferCopyPhase(backBufferCopy)
c2 = buildBackBufferCopyPhase(backBufferCopyB)
d0 = buildDownSamplePhase(backBufferCopy.texture, downSample1)
computeMeanVariance = buildMeanVariancePhase(downSample1.texture, downSample1B)
selectVariance = buildVarianceSelectPhase(downSample1B.texture, None)
s = build9TapFilterPhase(backBufferCopyB.texture, backBufferCopy, edgeDetectFilter)
d = buildEdgeDilationPhase(backBufferCopy.texture, backBufferCopyB)
t = buildTransferPhase(backBufferCopyB.texture, BW_BLEND_ZERO, BW_BLEND_SRCCOLOR)
e = Effect()
e.name = 'Posterise and Edge'
e.phases = [c,
c2,
d0,
computeMeanVariance,
selectVariance,
s,
d,
t]
return e
示例3: playerFader
def playerFader():
"""This method creates and returns a post-process effect that fades
out the player when they get too close to the camera.
This effect only works in the client, as there is no player in the tools."""
backBufferCopy = rt('PostProcessing/backBufferCopy')
e = Effect()
e.name = 'Player Fader'
try:
from _PostProcessing import PlayerFader
p = PlayerFader()
except:
p = None
if p is not None:
c = buildBackBufferCopyPhase(backBufferCopy)
p.renderTarget = backBufferCopy
p.clearRenderTarget = False
p.name = 'Player Fader'
t = buildTransferPhase(backBufferCopy.texture, BW_BLEND_SRCALPHA, BW_BLEND_INVSRCALPHA)
t.material.alphaOverdrive = 255.0
t.material.alpha = p.opacity
t.material.alphaTestEnable = True
t.material.alphaReference = 1
e.bypass = p.opacity
e.phases = [c, p, t]
else:
e.phases = []
return e
示例4: multiBlur
def multiBlur(filterMode = 0):
"""This method creates and returns an effect that down-samples and
blurs the back-buffer. *It relies on the down sample buffers already
having been created*. It fills the downSampleBlur1/2/3 render targets."""
downSample1 = rt('PostProcessing/downSample1')
downSample1B = rt('PostProcessing/downSample1B')
downSample2B = rt('PostProcessing/downSample2B')
downSample3B = rt('PostProcessing/downSample3B')
downSampleBlur1 = rt('PostProcessing/downSampleBlur1')
downSampleBlur2 = rt('PostProcessing/downSampleBlur2')
downSampleBlur3 = rt('PostProcessing/downSampleBlur3')
bh1 = buildBlurPhase(downSample1.texture, downSample1B, True, filterMode, 1.0)
bv1 = buildBlurPhase(downSample1B.texture, downSampleBlur1, False, filterMode, 1.0)
bh2 = buildBlurPhase(downSampleBlur1.texture, downSample2B, True, filterMode, 1.0)
bv2 = buildBlurPhase(downSample2B.texture, downSampleBlur2, False, filterMode, 1.0)
bh2a = buildBlurPhase(downSampleBlur2.texture, downSample2B, True, filterMode, 1.0)
bv2a = buildBlurPhase(downSample2B.texture, downSampleBlur2, False, filterMode, 1.0)
bh3 = buildBlurPhase(downSampleBlur2.texture, downSample3B, True, filterMode, 1.0)
bv3 = buildBlurPhase(downSample3B.texture, downSampleBlur3, False, filterMode, 1.0)
bh3a = buildBlurPhase(downSampleBlur3.texture, downSample3B, True, filterMode, 1.0)
bv3a = buildBlurPhase(downSample3B.texture, downSampleBlur3, False, filterMode, 1.0)
e = Effect()
e.name = 'Multi Blur'
phases = [bh1,
bv1,
bh2,
bv2,
bh3,
bv3,
bh3a,
bv3a]
e.phases = phases
return e
示例5: sharpen
def sharpen():
"""This method creates and returns a post-process effect that sharpens
the back buffer. It does this by using a generic sharpening filter kernel.
"""
backBufferCopy = rt("PostProcessing/backBufferCopy")
c = buildBackBufferCopyPhase(backBufferCopy)
s = build9TapFilterPhase(backBufferCopy.texture, None, sharpFilter)
e = Effect()
e.name = "Sharpen"
e.phases = [c, s]
return e
示例6: colourCorrectHSV
def colourCorrectHSV():
"""This method creates and returns a post-process effect that performs
hsv colour correction, or tone mapping, based on the colour_correct_hsv.fx effect.
"""
backBufferCopy = rt('PostProcessing/backBufferCopy')
e = Effect()
e.name = _hsvColourCorrectEffectName
c = buildBackBufferCopyPhase(backBufferCopy)
p = buildHSVColourCorrectionPhase(backBufferCopy.texture, None)
e.phases = [c, p]
return e
示例7: colourCorrect
def colourCorrect(texName = 'system/maps/post_processing/colour_correct.dds'):
"""This method creates and returns a post-process effect that performs
colour correction, or tone mapping, based on the colour_correct.fx effect.
"""
backBufferCopy = rt('PostProcessing/backBufferCopy')
e = Effect()
e.name = _colourCorrectEffectName
c = buildBackBufferCopyPhase(backBufferCopy)
p = buildColourCorrectionPhase(backBufferCopy.texture, texName, None)
e.phases = [c, p]
return e
示例8: depthOfFieldVariableCoC
def depthOfFieldVariableCoC():
"""This method creates and returns a post-process effect that performs
depth-of-field, using a variable-sized convolution kernel.
"""
backBufferCopy = rt('PostProcessing/backBufferCopy')
fpComputeBuffer1 = rt('PostProcessing/fpComputeBuffer1')
c = buildBackBufferCopyPhase(backBufferCopy)
t = buildDOFVariableCoCPhase(backBufferCopy.texture, fpComputeBuffer1.texture, None, stochasticSample)
e = Effect()
e.name = 'Depth of Field (variable filter)'
e.phases = [c, t]
return e
示例9: FXAA
def FXAA():
backBufferCopy = rt('PostProcessing/backBufferCopy')
c = buildBackBufferCopyPhase(backBufferCopy)
lum = buildPhase(backBufferCopy.texture, None, 'shaders/anti_aliasing/fxaa_worldeditor_integration_luminance.fx', straightTransfer4Tap, BW_BLEND_ONE, BW_BLEND_ZERO)
lum.name = 'luminance'
lum.renderTarget = backBufferCopy
r = buildPhase(backBufferCopy.texture, None, 'shaders/anti_aliasing/fxaa_worldeditor_integration.fx', straightTransfer4Tap, BW_BLEND_ONE, BW_BLEND_ZERO)
r.name = 'transfer'
e = Effect()
e.name = 'FXAA'
e.phases = [c, lum, r]
return e
示例10: edgeDetect
def edgeDetect():
"""This method creates and returns a post-process effect that performs
edge detection and dilation of the resultant edges."""
backBufferCopy = rt('PostProcessing/backBufferCopy')
c = buildBackBufferCopyPhase(backBufferCopy)
s = build9TapFilterPhase(backBufferCopy.texture, None, edgeDetectFilter)
d = buildEdgeDilationPhase(backBufferCopy.texture, None)
e = Effect()
e.name = 'Edge Detect'
e.phases = [c,
s,
c,
d]
return e
示例11: distortionTransfer
def distortionTransfer(distortionTexture):
"""This method creates and returns a post-process effect that redraws
the screen, using a normal map to distort the image. Use this for
a fish-eye effect, full-screen shimmer/distort etc.
"""
backBufferCopy = rt('PostProcessing/backBufferCopy')
c = buildBackBufferCopyPhase(backBufferCopy)
r = buildPhase(backBufferCopy.texture, None, 'shaders/post_processing/legacy/transfer_distort.fx', straightTransfer4Tap, BW_BLEND_SRCALPHA, BW_BLEND_INVSRCALPHA)
r.name = 'distort and transfer'
r.material.distortionTexture = distortionTexture
e = Effect()
e.name = 'Distort and Transfer'
e.phases = [c, r]
return e
示例12: emboss
def emboss():
"""This method creates and returns a post-process effect that performs
greyscale embossing using a simple filter-kernel."""
backBufferCopy = rt('PostProcessing/backBufferCopy')
c = buildBackBufferCopyPhase(backBufferCopy)
g = buildGreyscalePhase(backBufferCopy.texture, None)
s = build9TapFilterPhase(backBufferCopy.texture, None, embossFilter)
e = Effect()
e.name = 'Emboss'
e.phases = [c,
g,
c,
s]
return e
示例13: rainbow
def rainbow():
"""This method creates and returns a post-process effect that draws
a rainbow, using the angle between the camera and the sun and a MIE
scattering diagram lookup texture.
"""
backBufferCopy = rt('PostProcessing/backBufferCopy')
c = buildBackBufferCopyPhase(backBufferCopy)
r = buildPhase(backBufferCopy.texture, None, 'shaders/post_processing/legacy/rainbow.fx', straightTransfer4Tap, BW_BLEND_ONE, BW_BLEND_ONE)
r.name = 'decode lee diagram'
r.material.lookupTexture = 'system/maps/post_processing/lee_diagram.bmp'
e = Effect()
e.name = 'Rainbow'
e.phases = [c, r]
return e
示例14: lensExplicit
def lensExplicit():
"""This method creates and returns a post-process effect that performs
lens simulation. It allows direct control over the depth-of-field area
and the falloff gradients. It outputs to an intermediate buffer,
designed for use by one of the depth-of-field simulations.
"""
backBufferCopy = rt('PostProcessing/backBufferCopy')
fpComputeBuffer1 = rt('PostProcessing/fpComputeBuffer1')
c = buildBackBufferCopyPhase(backBufferCopy)
w = buildExplicitLensSimulationPhase(backBufferCopy.texture, fpComputeBuffer1)
e = Effect()
e.name = 'Explicit Lens Simulation'
e.phases = [c, w]
return e
示例15: lensSimulation
def lensSimulation():
"""This method creates and returns a post-process effect that performs
lens simulation. It does this mathematically via the thin-lens formula,
simulating focal length, aperture and zFocus. It outputs to an
intermediate buffer, designed for use by one of the depth-of-field
simulations.
"""
backBufferCopy = rt('PostProcessing/backBufferCopy')
fpComputeBuffer1 = rt('PostProcessing/fpComputeBuffer1')
c = buildBackBufferCopyPhase(backBufferCopy)
w = buildThinLensSimulationPhase(backBufferCopy.texture, fpComputeBuffer1)
e = Effect()
e.name = 'Thin Lens Simulation'
e.phases = [c, w]
return e