Vizard 7 » Command Index » Vizard modules » vizfx » <vizfx>.addProjector
7.7

<vizfx>.addProjector

Create a texture projector node

<vizfx>.addProjector(  
texture  
blend = vizfx.BLEND_SPOTLIGHTBLEND  
useAlpha = True  
)  
texture
The <texture> object to project. Can be either a 2D or cube map texture.
blend = vizfx.BLEND_SPOTLIGHTBLEND
Controls how the projected texture color is blended with the surface color. Can be one of the following:

Mode

Description

vizfx.BLEND_NORMAL

vizfx.BLEND_AVERAGE

vizfx.BLEND_ADD

vizfx.BLEND_SUBTRACT

vizfx.BLEND_DARKEN

vizfx.BLEND_MULTIPLY

vizfx.BLEND_COLORBURN

vizfx.BLEND_LINEARBURN

vizfx.BLEND_LIGHTEN

vizfx.BLEND_SCREEN

vizfx.BLEND_COLORDODGE

vizfx.BLEND_LINEARDODGE

vizfx.BLEND_SPOTLIGHT

vizfx.BLEND_SPOTLIGHTBLEND

vizfx.BLEND_OVERLAY

vizfx.BLEND_SOFTLIGHT

vizfx.BLEND_HARDLIGHT

vizfx.BLEND_PINLIGHT

vizfx.BLEND_HARDMIX

vizfx.BLEND_DIFFERENCE

vizfx.BLEND_EXCLUSION

vizfx.BLEND_HUE

vizfx.BLEND_SATURATION

vizfx.BLEND_COLOR

vizfx.BLEND_LUMINOSITY

useAlpha = True
If True, the alpha value of the texture and projector node are used to blend the existing surface color with the computed projected color.

Remarks

Creates a <node> object that will project the specified texture from its position and orientation. The projector contains an <effect> object (<projector>.getEffect()) which can be applied to a <composer> or <node>. The projector will only affect objects that have shader effects enabled.

Return Value

<node> object with the following additional methods:

Method

Description

getEffect()

Get the <effect> object associated with the projector.

setVisible(mode)

Set the visibility of the projector effect.

getVisible()

Get the visibility of the projector effect.

setAlpha(value)

Set the alpha multiplier for the projected texture.

getAlpha()

Get the alpha multiplier for the projected texture.

setTexture(texture)

Set the texture to project.

getTexture()

Get the texture being projected.

setProjectionMatrix(matrix)

Set the projection matrix to use when projecting 2D textures.

getProjectionMatrix()

Get the projection matrix being used to project the texture.

setFov(vert, ratio=1.0)

Shortcut for setting a perspective projection matrix using the specified vertical FOV and aspect ratio.

setOrtho(size)

Shortcut for setting an orthographic projection matrix using the specified [width,height] size.

Example

# Create texture
texture = viz.addTexture('crosshair.png')

# Create projector
projector = vizfx.addProjector(texture)

# Apply projector effect to composer
vizfx.getComposer().addEffect(projector.getEffect())

See also

<vizfx>.getComposer