WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 09-18-2014, 08:34 AM
performlabrit performlabrit is offline
Member
 
Join Date: Oct 2013
Posts: 74
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 08:41 AM.
Reply With Quote
  #2  
Old 09-19-2014, 05:20 AM
Erikvdb Erikvdb is offline
Member
 
Join Date: May 2013
Posts: 60
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())
.. 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
Code:
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.
Reply With Quote
  #3  
Old 09-19-2014, 09:46 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
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.
Reply With Quote
  #4  
Old 09-19-2014, 11:44 AM
performlabrit performlabrit is offline
Member
 
Join Date: Oct 2013
Posts: 74
Thanks, Farshizzo!

That seems like it would work. Thanks very much!
Reply With Quote
Reply

Tags
duplicate scene, eye tracker, eyetracker, hmd

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to display Chinese characters in info? KellySu Vizard 1 04-24-2012 08:56 AM


All times are GMT -7. The time now is 01:32 AM.


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