WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   Stereo HUD and Nvis SX111 (https://forum.worldviz.com/showthread.php?t=3038)

kopper 10-20-2010 02:09 PM

Stereo HUD and Nvis SX111
 
Hi, I am trying to set up a Vizard application to display in our Nvis SX111 using the NVis module:

nvis.nvisorSX111()


Everything looks fine, except some HUD information that I display using screen coordinates, which causes the HUD to appear as double images when looking through the HMD, since the screen coords are the same for both eyes.

My question is how can I make Vizard display a HUD in SX111 (or any partial overlap stereo HMD, for that matter)?

I tried changing the viz.stereoHUD in vizcore.cfg, but that just caused the HUD to be displayed in a single eye.

In other words, what I need is for an orthogonal projection to be able to display in a partially overlapping HMD seamlessly. The way I imagine this could be done would be to account for the partial overlap, and display the same HUD graphics in the overlapping portions, and the respective graphics in each of the non-overlapping portions of the display. However, I don't think I can access directly each eye image from the NVis module, and I hope there is a more straight forward way to achieve this.

Any help is appreciated.

Thank you,

Regis

masaki 10-21-2010 12:23 PM

Hello,

Try the following code to move the slider around to get the correct viz.MainWindow.setOrthoOffset() value. On our sx111, around -196 looks just about right.

Code:

import viz
viz.go()

viz.add('tankmaze.wrl')

text = viz.addText('Hello World',parent=viz.ORTHO,fontSize=60,align=viz.TEXT_CENTER_CENTER)
viz.link(viz.CenterCenter,text)

slider = viz.addSlider(pos=(0.5,0.1,0))
slider.set(0.5)
def SetOffset(pos):
        offset = vizmat.Interpolate(-400,-100,pos)
        viz.MainWindow.setOrthoOffset( offset )
        print offset
vizact.onslider(slider,SetOffset)

import nvis
hmd = nvis.nvisorSX111()

Best,
Masaki

kopper 10-22-2010 09:19 AM

Thanks, Masaki, for your reply.

I used the code you sent and it indeed worked to have the HUD to display correctly in the HMD.

However, when I try to add an image, instead of a text to the hud, it does not display, if I set parent to viz.ORTHO. The way I have it working in mono is the following:

Code:

        crosshair = viz.addTexQuad(viz.SCREEN,texture=viz.add('crosshair.png'))
        crosshair.setPosition([0.5,0.5,0])

When I try to add the image with viz.ORTHO as parent, like this:

Code:

        crosshair = viz.addTexQuad(viz.ORTHO,texture=viz.add('crosshair.png'))
        w = int(viz.getOption('viz.monitor.width'))
        h = int(viz.getOption('viz.monitor.height'))
        crosshair.setPosition([0.5*w,0.5*h,0])

nothing shows on the screen.

Could you point me how I can do the equivalent to the example you sent before, but with an image, instead of text?

Thanks a lot!

Regis

masaki 10-22-2010 10:45 AM

Hi,

You need to scale your crosshair object much larger and also instead of viz.monitor.width/height you need to do viz.MainWindow.getSize( viz.WINDOW_ORTHO ) and since you're in stereo you need to multiply the width by .25 not .5. Alternatively, you can link it to viz.CenterCenter.
Code:

import viz
viz.go(viz.FULLSCREEN)

viz.add('gallery.ive')

crosshair = viz.addTexQuad(viz.ORTHO,texture=viz.add('crosshair.png'))
crosshair.scale(100,100,1)
w,h = viz.MainWindow.getSize( viz.WINDOW_ORTHO )
crosshair.setPosition([0.25*w,0.5*h,0])

slider = viz.addSlider(pos=(0.5,0.1,0))
slider.set(0.5)
def SetOffset(pos):
        offset = vizmat.Interpolate(-400,-100,pos)
        viz.MainWindow.setOrthoOffset( offset )
        print offset
vizact.onslider(slider,SetOffset)

import nvis
hmd = nvis.nvisorSX111()

Best,
Masaki

kopper 10-25-2010 02:44 PM

1 Attachment(s)
Thanks Masaki, it now works as expected.

I have another similar issue, but now it's with the projector extension. I'm using projected textures to emulate a spotlight in my application. It's not a realistic spotlight, but just a texture shaped like a torus that is semitransparent on the edges and has a transparent hole in the center.

It is used to define a guiding path for the user to follow with the eyes, and I did not use the spotlight lighting effect because it would be much more complex as I would've to tessellate the geometry faces, etc.

Anyway, this projected texture, I link it to the mainview position, and change it's orientation (pitch and yaw) in an animation path to be followed by the user.

Here is the code used for the creation of the spotlight and animation path:
Code:

import projector
spotlight = projector.add(viz.add('spotlight.png'))

spotlight.setEuler([15,0,90])

#State the geometry that can have the shadow cast upon them
spotlight.affect(model)

spotlight.setPosition(initial_pos)

spotlight_path = viz.addAnimationPath()

eulers = [[24.11, -4.72, 0.00], [12.95, -16.99, 0.00], ...]
times  = [0.07, 1.14, ...]

for x in enumerate(eulers):
        #Add the control point to the animation path
        #at the new time
        cp = viz.addControlPoint()
        cp.setEuler(eulers[x])
        spotlight_path.add(cp,times[x])

viz.link(spotlight_path, spotlight)

...

spotlight_path.play()


What I couldn't find a way to do was to apply the same offset that is applied to the HUD, now to the projected texture.

Attached is an image of the projected spotlight, with the two views. The idea is to have the spotlight (which is a projected texture) illuminating the same geometry in both images.

I hope that the explanation was clear enough.

Thank you for your help!

Regis

kopper 10-29-2010 07:05 AM

Hi,

Does anybody have any suggestion on how to achieve the above? Or perhaps an alternative to the projected textures to produce similar results, yet supporting stereo?

Thanks,

Regis


All times are GMT -7. The time now is 03:46 PM.

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