|
|
Thread Tools | Rate Thread | Display Modes |
#1
|
|||
|
|||
Copy scene1 into scene2? Useful for copying HMD window to experimental monitor.
Simple question, followed long explanation that should make this thread helpful to users of HMDs. Especially those that use eye trackers.
Simple question: How do I copy the contents of scene 1 into scene 2? Note that I will want to make additions to scene 2 that will not effect scene 1. I hope there is a computationally efficient solution. --- Here's the long version: I use eye trackers and HMDs. I want to duplicate the HMD display on a monitor that can be viewed by the experimenter. Note that HMDs require distorting the render account for the helmet optics/geometry. I do not want this distortion on the experimenter's display. I also want to add additional information to the experimenter display (for example, the point of regard from an eyetracker). I've made some progress already. I span a window across both displays, splitting the window into 2 views, view 1 on display 1 (experimenter) and view 2 on display 2 (HMD). The HMD display will display the root scene. The Exp display will show a copy, with some changes. Note that, in my current setup with an NVIS SX111, I actually render across 2 displays for the HMD, and only want the EXP display to copy the left eye. For this reason, I improt the NVIS SX111 module, and multiple the width of the window by 2: So, that's this code: Code:
# In extend() viz.MainWindow.setSize([monitorSizes_m[hmdMon][0]*2, monitorSizes_m[hmdMon][1]], mode=viz.WINDOW_PIXELS) # after viz.go() import nvis hmd = nvis.nvisorSX111() This had made things just a bit more complicated. I hope to switch entirely to the Oculus DKII as soon as an eye-tracker mod is available SMI!?!?) I'll past my current progress below. Note that this code draws upon an older thread Code:
def extend(primaryMon = 2,leftEyeMon = 0): monitors = viz.window.getMonitorList() monitorSizes_m = [] for m in monitors: monitorSizes_m.append(m.size) ctrlwndw = viz.addWindow() # Position ctrlwndw on the primary monitor ctrlwndw.setSize(monitorSizes_m[primaryMon], mode=viz.WINDOW_PIXELS) ctrlwndw.setPosition(0,monitorSizes_m[primaryMon][1], mode=viz.WINDOW_PIXELS) ctrlwndw.setScene(viz.Scene2) viz.MainWindow.setSize([monitorSizes_m[leftEyeMon][0]*2, monitorSizes_m[leftEyeMon][1]], mode=viz.WINDOW_PIXELS) viz.MainWindow.setPosition(monitorSizes_m[primaryMon],mode=viz.WINDOW_PIXELS) text1 = viz.add(viz.TEXT3D,'HMD',parent=viz.SCREEN,scene=viz.Scene1) text2 = viz.add(viz.TEXT3D,'EXP',parent=viz.SCREEN,scene=viz.Scene2) extend = extend() viz.add('piazza.osgb') #viz.window.setFullscreenMonitor([2,1]) viz.go(viz.FULLSCREEN) import nvis hmd = nvis.nvisorSX111() #scene1Children = viz.Scene1.getChildren() #viz.Scene2.setChildren(scene1Children) Last edited by performlabrit; 09-18-2014 at 07:41 AM. |
#2
|
|||
|
|||
Coincidentally I just started working on a multi-scene project as well, and I was wondering the same thing. You can use <node3d>.copy or <node3d>.clone to duplicate your objects to different scenes, but it's a pain in the ass to set all positions and orientations for every object in every scene independently.
Of course you could make a function like: Code:
def cloneToScene2(): objects = viz.Scene1.getChildren() for object in objects: object2 = object.clone(scene=2) object2.setPosition(object.getPosition()) object2.setEuler(object.getEuler()) In my case I only have to view one scene at the time, so I just move objects from scene to scene Code:
def changeScene(scene): for object in objects_to_move: object.setParent(viz.WORLD, scene) |
#3
|
|||
|
|||
Have a look at the <node>.renderOnlyToWindows() command. It allows you to control which sub-windows a node will render to. There is no need to clone/duplicate nodes and scenes. Just add everything to the same default scene and use this command to customize the rendering for certain windows.
Let me know if this doesn't address your specific problem. |
#4
|
|||
|
|||
Thanks, Farshizzo!
That seems like it would work. Thanks very much!
|
Tags |
duplicate scene, eye tracker, eyetracker, hmd |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to display Chinese characters in info? | KellySu | Vizard | 1 | 04-24-2012 07:56 AM |