WorldViz User Forum

WorldViz User Forum (
-   Vizard (
-   -   Duplicate HMD display on primary monitor, with eyetracking info (

performlabrit 09-18-2014 07:34 AM

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:


# 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


def extend(primaryMon = 2,leftEyeMon = 0):
        monitors = viz.window.getMonitorList()
        monitorSizes_m = []
        for m in monitors:
        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)
        viz.MainWindow.setSize([monitorSizes_m[leftEyeMon][0]*2, monitorSizes_m[leftEyeMon][1]], 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()



import nvis
hmd = nvis.nvisorSX111()

#scene1Children = viz.Scene1.getChildren()

Erikvdb 09-19-2014 04:20 AM

Coincidentally I just started working on a multi-scene project as well, and I was wondering the same thing. You can use .copy or .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:

def cloneToScene2():
        objects = viz.Scene1.getChildren()
        for object in objects:
                object2 = object.clone(scene=2)

.. but it's not a very pretty solution imo, so if there's a better/faster built-in way to do this, I'd like to know about that as well.

In my case I only have to view one scene at the time, so I just move objects from scene to scene :p

def changeScene(scene):
        for object in objects_to_move:
                object.setParent(viz.WORLD, scene)

Also very helpful for viewing the proximity manager debug nodes at all times, because for some reason they only render in the main scene by default.

farshizzo 09-19-2014 08:46 AM

Have a look at the .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.

performlabrit 09-19-2014 10:44 AM

Thanks, Farshizzo!
That seems like it would work. Thanks very much!

All times are GMT -7. The time now is 09:21 AM.

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