PDA

View Full Version : To Masaki regarding render nodes


surf3rguy
04-10-2012, 05:12 PM
Hello,
I am trying to render a virtual environment on a render node that is located within another virtual environment. Both worlds need to run simultaneously, one on the render node, and the other on containing the render node. How is this task accomplished?

masaki
04-17-2012, 05:37 PM
Here is some sample code to get you started. This will create two different environments (scenes). One has the piazza and one has the dojo. The rendernode will render the dojo scene within the piazza scene.

import viz
viz.go()

#add a world
world1 = viz.add('piazza.osgb')

#add a second scene
scene2 = viz.addScene()
#add a second world and set to it the second scene
world2 = viz.add('dojo.osgb', viz.WORLD, 2)
#add a render node
renderNode = viz.addRenderNode( )
#set the scene of the render node to 2
renderNode.setScene(2)
#add a render texture at 512x512 resolution
renderTexture = viz.addRenderTexture(size=[512,512])
#attach the rendertexture
renderNode.attachTexture( renderTexture)

#add a texture quad
quad = viz.addTexQuad()
#add the rendertexture to the texturequad
quad.texture( renderTexture )
#position the texture quad
quad.setPosition(0,1,0)


viz.MainView.setPosition(0,1.8,-3)

Masaki