PDA

View Full Version : Create object with position relative to user head, but cannot be obstructed by others


Notch
02-26-2014, 06:46 AM
I'm trying to simulate what it's like to have a form visual impairment. The condition causes 'holes' in the vision. For a basic form of this, I'd like to create an occluding quad that 'floats' in front of the user's viewpoint and covers anything seen.

My current solution is to create a quad with viz.HEAD as the parent. However, if I create this quad at exactly [0,0,0] from viz.HEAD, it is not seen. I need to shift the quad a few mm forward in order for it to be seen. Presumably, WorldViz models the 'eyes' of the user slightly in front of [0,0,0] of viz.HEAD.

So, I created a quad that 'floats' 25cm in front of the user's head, partially obscuring the view. This works nicely, and moves whenever I move the head. The trouble is, if I walk up to an object or wall, the wall 'pops through' the floating quad, so that it can be seen. I need the obscuring veil to cover everything in view, regardless of how close objects come.

I know that I could make the quad's parent viz.SCREEN. The problem with that is that the condition I'm trying to simulate is a dynamic one; the visual occlusion actually shifts depending on the position of the body, so I need to have active control over the position of the veil relative to the user's head.

I thought one solution might be to create a vizshape.Box and have this hang relative to the user's head. As a three-dimensional shape, I could have it cover all the area from [0,0,0] out to a few centimetres in front, which would circumvent the weird issue that causes a quad to be invisible unless it is a certain distance in front of the user. The difficulty with this approach is that I don't know how to lock the position of a 3D shape to viz.HEAD.

Is there any way of locking a vizshape to the parent 'viz.HEAD', or can anyone offer any creative solutions?

Any advice would be appreciated.

masaki
02-26-2014, 05:10 PM
You can link the box to the main view, then pre multiply the link with a translation to keep the box in your view. To keep it from being occluded, you can disable depth test and give it a high draw order.


box = vizshape.addBox()
link = viz.link( viz.MainView, box )
link.preTrans([0,0,3])
box.disable( viz.DEPTH_TEST )
box.drawOrder(100)


Masaki

performlabrit
03-03-2014, 07:16 AM
Vision scientist here. Awesome idea, Notch! Best of luck with that.