Vizard 7 » Reference » Shaders » Effects » Projector Effects
7.7

Projector Effects

The vizfx projector effect allows you to project a texture onto the surface of any other object that has shader effects enabled. This can be useful for simulating an actual camera projector, a flashlight, or creating other interesting lighting effects.

 

The vizfx.addProjector command is used to create a projector node. The command requires a <texture> object, which can be either a 2D or cube map texture. The returned <projector> node can be translated and rotated like any other node to control where the texture is projected from. The <projector> node also contains an <effect> object which can be applied to a <composer> or other <node>.

 

The example below creates a projector using a 2D texture and is applied to the default composer:

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

# Create projector
projector = vizfx.addProjector(texture)

# Apply projector effect to composer
vizfx.getComposer().addEffect(projector.getEffect())
Projector using a 2D texture

 

The projector supports various blend modes to control how the texture is combined with the surface. See he vizfx.addProjector command for a list of all the supported blend modes. For example, here is the projector using vizfx.BLEND_HARDLIGHT:

# Create projector using Hard Light blending
projector = vizfx.addProjector(texture, blend=vizfx.BLEND_HARDLIGHT)
Projector using Hard Light blend mode

 

For 2D textures, the projector uses a 90 degree FOV by default. The projection matrix can be modified to use any FOV or even an orthographic projection. The example below uses an orthographic projection to place the cross hair on top of the logo:

# Create projector with orthographic projection
projector = vizfx.addProjector(texture)
projector.setOrtho([5,5])
Projector with orthographic projection

 

With cube map textures, the image is projected in all directions from the projectors position and rotation. Here is an example of using a cube map texture and also using the alpha setting to lower the intensity of the projector:

# Create cube map
texture = viz.addEnvironmentMap('holes.png')

# Create projector
projector = vizfx.addProjector(texture, blend=vizfx.BLEND_ADD)
projector.setAlpha(0.2)

# Apply projector effect to composer
vizfx.getComposer().addEffect(projector.getEffect())
Projector with cube map

Effect Basics

Lighting Effects

Projector Effects

Custom Effects

Example Effects