Vizard 6 » Reference » Shaders » Post-Process Effects » Distort effects
6.3

Distort effects

The vizfx.postprocess.distort library is a collection of effects that perform various distortions on the rendered image by modifying the texture coordinates of each pixel.

 

Pincushion

 

Applies a pincushion/barrel distortion on the image.

 

Constructor

Description

PincushionEffect(

    k1 = 0.0,

    scaleToFit = True

)

Create the pincushion effect with the initial k1 factor and scaleToFit setting.

 

Method

Description

<effect>.setK1(value)

Set the k1 value of the distortion. A positive value results in a barrel distortion, a negative value results in a pincushion distortion.

<effect>.getK1()

Get the k1 distortion value.

<effect>.setScaleToFit(value)

Set whether distortion is scaled to fit resolution of output image.

<effect>.getScaleToFit()

Get scale to fit setting.

 

This effect can be registered with vizconfig.

 

import vizfx.postprocess
from vizfx.postprocess.distort import PincushionEffect
effect = PincushionEffect(0.5)
vizfx.postprocess.addEffect(effect)

 

Pixelate

 

Pixelates the image.

 

Constructor

Description

PixelateEffect(pixelSize = (1,1))

Create the pixelate effect with the initial pixelSize.

 

Method

Description

<effect>.setPixelSize(size)

Set the [width,height] pixel size. This is the number of actual pixels that will make up the virtual pixel.

<effect>.getPixelSize()

Get the [width,height] pixel size.

 

This effect can be registered with vizconfig.

 

import vizfx.postprocess
from vizfx.postprocess.distort import PixelateEffect
effect = PixelateEffect([10,10])
vizfx.postprocess.addEffect(effect)

 

Bulge

 

Bulges the image.

 

Constructor

Description

BulgeEffect(

    bulge = 0.0,

    radius = 0.5,

    center = (0.5,0.5)

)

Create the bulge effect with the initial bulge factor, radius, and center.

 

Method

Description

<effect>.setBulge(value)

Set the bulge factor. Typically ranges from -1 to 1. Positive value bulges the image outwards, negative value bulges the image inward.

<effect>.getBulge()

Get the bulge factor.

<effect>.setRadius(radius)

Set the bulge radius in normalized (0-1) image units.

<effect>.getRadius()

Get the bulge radius in normalized (0-1) image units.

<effect>.setCenter(center)

Set the bulge [x,y] center in normalized (0-1) image units.

<effect>.getCenter()

Get the bulge [x,y] center in normalized (0-1) image units.

 

This effect can be registered with vizconfig.

 

import vizfx.postprocess
from vizfx.postprocess.distort import BulgeEffect
effect = BulgeEffect(0.5)
vizfx.postprocess.addEffect(effect)

 

Twist

 

Twists the image.

 

Constructor

Description

TwistEffect(

    twist = 0.0,

    radius = 0.5,

    center = (0.5,0.5)

)

Create the twist effect with the initial twist angle, radius, and center.

 

Method

Description

<effect>.setTwist(twist)

Set the twist angle in degrees. Positive value twists the image clockwise, negative value twists the image counter-clockwise.

<effect>.getTwist()

Get the twist angle in degrees.

<effect>.setRadius(radius)

Set the twist radius in normalized (0-1) image units.

<effect>.getRadius()

Get the twist radius in normalized (0-1) image units.

<effect>.setCenter(center)

Set the twist [x,y] center in normalized (0-1) image units.

<effect>.getCenter()

Get the twist [x,y] center in normalized (0-1) image units.

 

This effect can be registered with vizconfig.

 

import vizfx.postprocess
from vizfx.postprocess.distort import TwistEffect
effect = TwistEffect(180)
vizfx.postprocess.addEffect(effect)

 

Wave

 

Applies a sine wave to the image.

 

Constructor

Description

WaveEffect(

    amplitude = 0.0,

    period = 1.0,

    offset = 0.0,

    angle = 0.0,

    repeat = False

)

Create the wave effect with the initial parameters.

 

Method

Description

<effect>.setAmplitude(twist)

Set the amplitude of the wave in normalized (0-1) image units.

<effect>.getAmplitude()

Get the amplitude of the wave in normalized (0-1) image units.

<effect>.setPeriod(radius)

Set the period of the wave in normalized (0-1) image units.

<effect>.getPeriod()

Get the period of the wave in normalized (0-1) image units.

<effect>.setOffset(center)

Set the offset of the wave along the horizontal axis in normalized (0-1) image units.

<effect>.getOffset()

Get the offset of the wave along the horizontal axis in normalized (0-1) image units.

<effect>.setAngle(value)

Set the angle of the vertical axis of the wave, in degrees. 0 is upward, and positive angles go clockwise.

<effect>.getAngle()

Get the angle of the vertical axis of the wave, in degrees.

<effect>.setRepeat(value)

Set whether to repeat the image when UV coordinates are outside (0-1) range.

<effect>.getRepeat()

Get whether to repeat the image when UV coordinates are outside (0-1) range.

 

This effect can be registered with vizconfig.

 

import vizfx.postprocess
from vizfx.postprocess.distort import WaveEffect
effect = WaveEffect(amplitude=0.05, period=3.0)
vizfx.postprocess.addEffect(effect)

 

Post-Process Basics

Color Effects

Distort Effects

Blur Effects

Transform Effects

Composite Effects