WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   Stereoscopic Vizard Question (https://forum.worldviz.com/showthread.php?t=536)

mikestatic 03-13-2006 08:21 AM

Stereoscopic Vizard Question
 
We recently installed a GeForce FX 5500 AGP 8x Dual Display card (w/ 2 VGA outputs) that we use to power our V8 headset in stereoscopic mode. The card seemed to work very well for our purposes until we noticed that only the left display was rendering the avatars in our program. The right display rendered everything else perfectly, it simply does not show the avatars in the program (e.g., close your right eye the avatars are there, close your left eye and they disappear). Both displays are set to the same specifications (as far as I can tell). Does anyone have any insights into what might be causing this?

tobin 03-13-2006 09:32 AM

How are you engaging stereo mode for your Vizard simulation. You should be selecting "horizontal span" under the nView settings on your nVidia card driver. Then from the Vizard side, you should enable viz.go(viz.STEREO | viz.HMD) to have Vizard draw both the left and right eye images.

Is this what you are doing or are you doing something different?

mikestatic 03-13-2006 11:46 AM

Ghost-avatars
 
The video card is set up to display horizontally (so now the display is 2 monitors wide when not running a vizard program) and we are manually setting the vizard display options using the PROMPT command (in which we are checking HMD, Fullscreen, stereoscopic, and tracking).

I want to re-emphasize, we are getting the stereoscopic, 3-D effect for the entire environment (except for the avatars positioned in the environment). Vizard is sending slightly different images to each eye to make the 3-D effect work. The only exception is with avatars--the left image displays the enviroment with avatars in their proper position, the right image displays the environment with no avatars. (The avatars remain still and motionless during the program.) This produces a weird ghost-avatar effect when experiencing the environment with both eyes open as the environment is perfectly rendered in 3-D, but the avatars are present only in the left eye.

tobin 03-13-2006 10:15 PM

Thanks for the clarification. But to press a little further, do you use nVidia's nView Horizontal Span to get the desktop spread across the two monitors or are you using the DualView setting. There is an important albeit subtle difference between the two and you want to be absolutely certain you're using the former.

If you run the gallery world demo that's part of your Vizard installation, do you get this effect with the avatars in that script?

mikestatic 03-14-2006 11:42 AM

Thank you for pressing further--we had been using it in dual display mode and not in the horizontal display mode. The avatars now display properly.

A follow-up if I may:

We are regularly getting vertical lines in our V8 display both in mono and stereo modes (regluarly spaced across the length of both eye displays). Is there any chance that this may be a software issue? I am somewhat resigned to it being an issue with our V8 headset, but I thought I might ask if you have heard of this issue before. We are not calling up any special display options when loading and as I mentioned before it occurs in both mono and stereo modes. Any insights would be helpful--I really appreciate your help.

tobin 03-14-2006 01:47 PM

I've seen those artifacts on V8s myself and they are a hardware issue. It would be worth contacting Virtual Research and asking whether and what they'd charge to clean or refurbish your HMD. They have an excellent reputation for standing behind their products.

mikestatic 03-14-2006 03:32 PM

Thanks for your help.

betancourtb82 03-20-2006 02:36 PM

I wanted to follow up with this issue. I'm having a bit of a problem with my code. Everything works according to plan, however, if I close my left eye and try to look through only my right eye, the mouse does not show accurately. The mouse cursor is being used as an "aiming" device and bullets shoot from the point where the mouse is pointing. When I aim with my left eye, I can aim at the target and shoot fine, but when I close the left eye and aim with my right eye, even if I point directly at the target, the bullet goes through the target and nothing happens to the avatar. Here is my code:
Code:

import viz
import vizmat
import math
import time
viz.go(viz.STEREO | viz.TRACKER | viz.FULLSCREEN)
#commands to enable HMD tracking
if viz.get(viz.TRACKER):
        v = viz.add('intersense.dls')
        #pos = viz.add('vizppt.dls')
        viz.tracker()
        v.reset()
        tracking = 1
else:
        tracking = 0
        viz.collision(viz.ON)

viz.translate(viz.HEAD_POS,0,0,-1)

#Set eye distance to 0 to show why the bullet goes to the left of the mouse
viz.ipd(0)

#arrays
avatars = []                        #for avatars
bullets = []                        #for number of balls
dead_list = []                        #list for dead avatars

#constants
NUM_BULLETS = 3                                #number of balls in the array
BULLET_SPEED = 250                        #speed in meters/secs of the bullet
rotRight = viz.Transform()        #bullet rotation
rotRight.setRot(0,1,0,-90)
ANIMATION = 1                                #animation ID
NUM_AVATARS        = 6                                #the number of avatars
TIME_BETWEEN_AVATARS = 5        #time between each avatar
START_AVATAR = 0                        #flag to start avatars
nextAvatar = 0                                #index for avatars
nextBullet = 0                                #index for the next ball in the array
ACTIVE_AVATARS = 5                        #create a flag to reset array
index = NUM_AVATARS                        #looping index
nextAvatar = 0
theta = (math.pi / 3)

sunlight = viz.add(viz.LIGHT)
sunlight.position(10,10,-20)
sunlight.direction(-0.5,-0.5,1)
sunlight.color(1,1,1)

sky = viz.add('skydome.dlc',0,'',15)
env = viz.add(viz.ENVIRONMENT_MAP,'sky.bmp')
sky.texture(env)
sky.disable(viz.FOG)

court = viz.add('terrain1.wrl')
court.scale(0.5,0.5,0.5)
court.rotate(0,1,0,-90)
court.translate(-5,0,-10)
court.appearance(viz.MODULATE)
court.disable(viz.LIGHT0)

#Add a crosshair
crosshair = viz.add(viz.TEXQUAD,viz.SCREEN)
crosshair.texture(viz.add('crosshair.tif'))


#print 'i\t\t\t\t\t''x\t\t\t\t\t\t''z'

#Create six avatars
for i in range(NUM_AVATARS):
        headpos = viz.get(viz.HEAD_POS)
        newX = -10 * math.sin(theta * i)
        newZ = 10 * math.tan(theta * i)
        if newZ <=10:
                newZ = -17
        else:
                newZ = 10 * math.tan(theta * i)
        #print i,"\t\t\t\t\t",newX,"\t",newZ
        male = viz.add('male.cfg')
        male.scale(1.25,1.25,1.25)
        male.translate(newX,-10,newZ)
        male.rotate(180,0,0)
        avatars.append(male) #Save avatar in list

#WalkForever = vizact.sequence(vizact.walkto(vizact.randfloat(-2,5),0,vizact.randfloat(-10,5)),viz.FOREVER)

def walkAvatar(starter):
        global court
        walk = starter.walkto(0,court,-10.5,1,260,2)
        #Clear all the avatar's actions, reposition it, and start the walk action
        starter.clear(viz.ALL)
        starter.act(walk)


for x in range(0,NUM_BULLETS):
        #create a bullet that is initially hidden
        bullet = viz.add('ball.wrl')
        bullet.scale(.1,.1,.1)
        bullet.visible(viz.OFF)
        bullet.disable(viz.COLLISION)
        bullet.active = 0
       
        #add the ball to the ball list
        bullets.append(bullet)

def RemoveAvatar(avatar):
       
        avatar.visible(0) #Hide avatar
        avatar.speed(1) #Restore speed
        avatars.remove(avatar) #Remove from list
        dead_list.append(avatar) #Add to dead list

def RestoreAvatar():
#        global court
        x = vizmat.GetRandom(-10,10)
        z = vizmat.GetRandom(-20,10)
        if len(dead_list):
                avatar = dead_list.pop() #Ressurrect dead avatar
                avatar.visible(1) #Make it visible
                avatars.append(avatar) #Add it to avatar list
                avatar.translate(x,0,z)
                walkAvatar(avatar)

def shootBullet():
        global nextBullet
        #find the next available ball to shoot
        bullet = bullets[nextBullet]
        nextBullet = (nextBullet + 1) % NUM_BULLETS
        #Calculate the vector of the ball based on the mouse position
        pos = viz.mousepos()
        bulletvector = viz.screentoworld(pos[0]+0.25,pos[1]) #Need to account for stereo
        bullet.vector = viz.Vector(bulletvector[3]-bulletvector[0],bulletvector[4]-bulletvector[1],bulletvector[5]-bulletvector[2])
        bullet.vector.normalize()
        bullet.vector *= BULLET_SPEED
       
        #translate the bullet to the head position
        bullet.translate(viz.get(viz.HEAD_POS))
       
        #make the bullet visible
        bullet.visible(viz.ON)
       
        #mark the bullet as active
        bullet.active = 1

def MoveBullet(bullet,elapsed):
        #get the bullet's current position
        pos = bullet.get(viz.POSITION)
       
        #calculate the balls future position based on it's velocity
        futurePos = pos + (bullet.vector * elapsed)
       
        #Check if bullet intersected with anything
        info = viz.intersect(pos,futurePos)
        if info.intersected:
                if info.object in avatars:
                        WaitThenFreeze = vizact.sequence( vizact.waittime(info.object.getduration(7)-0.05), vizact.speed_node(0) )
                        info.object.execute(7)
                        info.object.clear(viz.ALL)
                        info.object.clear(viz.CURRENT_ACTION)
                        info.object.add(WaitThenFreeze) #Add the action to the avatar
                        RemoveAvatarAction = vizact.call(RemoveAvatar,info.object)
                        info.object.add(RemoveAvatarAction) #Add action to remove avatar

                bullet.visible(0)
                bullet.active = 0
       
        #Update balls positions
        bullet.translate(futurePos.get())
def mytimer(num):
        global avatars
        if num == ANIMATION:
               
                #Calculate elapsed time since last update
                elapsed = viz.elapsed()
               
                #Update each active ball
                for bullet in bullets:
                        if bullet.active:
                                #Move the ball and check if it has collided with any objects
                                MoveBullet(bullet,elapsed)

                #Update the crosshair position
                crosshair.translate(viz.mousepos()+[0])

        elif num == START_AVATAR:
                global nextAvatar
                #Get the next available avatar and start it
                avatar = avatars[nextAvatar]
                walkAvatar(avatar)
                nextAvatar = (nextAvatar + 1) % len(avatars)
                print 'nextAvatar is', nextAvatar
                viz.starttimer(START_AVATAR,TIME_BETWEEN_AVATARS)

#Restore next available avatar
vizact.onkeydown(' ',RestoreAvatar)

#Shoot a ball whenever left mousebutton is clicked
vizact.onmousedown(viz.MOUSEBUTTON_LEFT,shootBullet)

#Create callbacks for timer events
viz.callback(viz.TIMER_EVENT,mytimer)

#Start a timer which starts the next available avatar
viz.starttimer(START_AVATAR,0.1)

#Start the animation timer, which animates the ball and checks for collisions
viz.starttimer(ANIMATION,0.01,-1)

#Move the head position back
viz.translate(viz.HEAD_POS,0,0,-10)       

#Disable mouse navigation
viz.mouse(viz.OFF)
#viz.cursor(0)



All times are GMT -7. The time now is 07:45 PM.

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