Vizard 8 » Reference » Appearance & Texturing » Projecting textures
8.0

Projecting textures

This plug-in allows you to add a light or shadow texture that is projected onto surfaces, and moves in relation to an object.

Procedure

This example shows how to use vizprojector to add an object, its projected textures, and surfaces on which to project.

import viz
import projector
viz.go()

viz.MainView.setPosition([0,1,-1])

#Add objects for the shadow to be cast upon
ground = viz.add('tut_ground.wrl')

#Sphere to have the shadow cast upon
ball = viz.add('white_ball.wrl')
ball.setScale([10,10,10])
ball.setPosition([0,0,4])

#Create projector group object
eyeBalls = projector.add(viz.add('eyeshadow.jpg'))

#Point shadow down
eyeBalls.setEuler([0,90,0])

#State the geometry that can have the shadow cast upon them
eyeBalls.affect(ground)
eyeBalls.affect(ball)

#Use a orthographic projection matrix instead of the default perspective projection matrix
eyeBalls.ortho(0.25,0.15)

#Add child geometry that follows shadow around
eyeGeometry = eyeBalls.add('eyeballs.osg')
eyeGeometry.setEuler([0,90,0])
eyeBalls.setPosition([0,1,3])
eyeBalls.addAction( vizact.spin(0,0,1,90))

Functions

The following functions are available within vizprojector.

Function

Takes

Description

fov

vertical, ratio

sets the field of view for the projection

ortho

width, height

sets the width and height of the projected texture

border

r,g,b

sets the color of the periphery

image

texture

 

affect

node

sets a node for projection

unaffect

node

removes a node from projection

See also

In this section:

Appearance & texturing basics

Texture wrapping

Multi-texturing

Environment mapping

Texture appearance and filtering

Texture types

Texture matrix

Visibility

Appearance & texturing command table

Example scripts:

Projection

Shadows

Alpha map