WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   To Masaki regarding render nodes (https://forum.worldviz.com/showthread.php?t=4196)

surf3rguy 04-10-2012 05:12 PM

To Masaki regarding render nodes
 
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.

Code:

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


All times are GMT -7. The time now is 06:45 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC