WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   Using current scene as a texture? (https://forum.worldviz.com/showthread.php?t=4866)

iva 11-05-2013 05:38 AM

Using current scene as a texture?
 
I don't know how to exactly explain what am I trying to do. I want to have a screen somewhere in the Vizard scene that is showing the scene from a certain viewpoint. I know how to do it in different windows, but windows are parented to screen, and I would like, somehow, to have them parented to the world, which doesn't really work. Does anybody have any ideas?

iva 11-05-2013 06:44 AM

Okay, I cannot edit my message, but I solved the problem and here is my code:

Code:

import viz

viz.go()
view=viz.MainView
viz.MainView.setPosition(-1.5,2.5,-6)
viz.MainView.setEuler(0,10,0)
viz.fov(70)

scene=viz.add("piazza.osgb")



WALL_SCALE = [1.6, 1.87, 1]

wall = viz.addTexQuad(size=1.87)
wall.setPosition( [-2, 0, 0] )
wall.zoffset(1) #avoid zfighing, make wall appear behind pictures
wall.setScale( WALL_SCALE )


wallL = viz.addTexQuad(size=1.87)
wallL.setPosition( [-3.5, 0, -1.5] )
wallL.setEuler(-90,0,0)
wallL.zoffset(1) #avoid zfighing, make wall appear behind pictures
wallL.setScale( WALL_SCALE )

wallR = viz.addTexQuad(size=1.87)
wallR.setPosition( [-0.5, 0, -1.5] )
wallR.setEuler(90,0,0)
wallR.zoffset(1) #avoid zfighing, make wall appear behind pictures
wallR.setScale( WALL_SCALE )




male = viz.add('vcc_male.cfg')
male.setPosition([-2, 0,-1.5])
male.state(9)

logo = viz.add('logo.ive',pos=(0,3,6))
logo.addAction(vizact.spin(0,1,0,45))
logo.scale(0.5, 0.5, 0.5)
# Create render texture
tex = viz.addRenderTexture()
texL = viz.addRenderTexture()
texR = viz.addRenderTexture()

# middle cave wall
cam = viz.addRenderNode()
cam.setSize(512,512)
cam.setInheritView(False)
cam.setPosition([0.0, 2.0, 0])
cam.lookAt([0,2,33])
cam.setFov(60,1.0,0.1,100)
cam.setRenderTexture(tex)
cam.setRenderLimit(viz.RENDER_LIMIT_FRAME)
wall.texture(tex)

# left cave wall
camL = viz.addRenderNode()
camL.setSize(512,512)
camL.setInheritView(False)
camL.setPosition([0, 2.0, 0])
#camL.setEuler([-90,0,0])
camL.lookAt([-19,2,11])
camL.setFov(60,1.0,0.1,100)
camL.setRenderTexture(texL)
camL.setRenderLimit(viz.RENDER_LIMIT_FRAME)
wallL.texture(texL)

# right cave wall
camR = viz.addRenderNode()
camR.setSize(512,512)
camR.setInheritView(False)
camR.setPosition([0.0, 2, 0])
camR.lookAt([19,2,11])
camR.setFov(60,1.0,0.1,100)
camR.setRenderTexture(texR)
camR.setRenderLimit(viz.RENDER_LIMIT_FRAME)
wallR.texture(texR)

I was trying to have a mini-cave inside of my scene, this is good enough :)

Erikvdb 11-06-2013 08:28 AM

For future reference you can always look at the 'The Pit' world demo, as well as the mirror script that's in the Worldviz Knowledge Base ;)

farshizzo 11-06-2013 08:39 AM

There are also some examples of using render nodes to render the scene to a texture in the Vizard/examples/renderNodes folder.

iva 11-09-2013 09:59 AM

Quote:

Originally Posted by Erikvdb (Post 15533)
For future reference you can always look at the 'The Pit' world demo, as well as the mirror script that's in the Worldviz Knowledge Base ;)

Hm, I completely forgot that the pit has this camera-like thingy. Oh well:)


All times are GMT -7. The time now is 10:15 AM.

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