View Single Post
  #2  
Old 05-05-2009, 12:38 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Yes, you can use a render node to render the scene to a texture from any arbitrary viewpoint. Then you just apply the texture to any object in the scene. Here is a sample script showing how to do this:
Code:
import viz
viz.go()

#Create render texture
renderTexture = viz.addRenderTexture()
	
#Create render node to render texture
renderNode = viz.addRenderNode()
renderNode.attachTexture(renderTexture)
renderNode.setInheritView(False)
	
#Set position/rotation of render node camera
renderNode.setPosition([0,10,0])
renderNode.setEuler([0,90,0])

#Apply render texture to object in scene
model = viz.add('gallery.ive')
model.texture(renderTexture,node='art04-FACES')

#Link an object to the viewpoint
arrow = viz.add('marker.wrl',scale=(2,2,2))
viewLink = viz.link(viz.MainView,arrow)
viewLink.setPos([None,0,None])
viewLink.setEuler([None,0,0])

#Get the party started
avatar = viz.add('vcc_female.cfg',pos=(0,0,2),euler=(180,0,0))
avatar.state(5)
Reply With Quote