> Date:         Tue, 20 Nov 2001 15:43:33 -0600
> From: Alex Terrazas <[EMAIL PROTECTED]>
>
> I think I have Java3D working with my HMD now.
> To get it working, I used two Canvas3D's one
> for the left eye and one for the right eye.
>
> The code snippet is:
> [...]
> My questions are the following:
>
> 1) Is the two canvas solution the preferred way to do HMD?
> Remember, a HMD is like two monitors.  We use the Virtual
> Research V8.  We set up the PC (Windows 2000) for dual
> monitors.
>
> 2) What is the use of view.setViewPolicy(View.HMD_VIEW);?

HMD_VIEW is required if you want head tracking, which allows the user to look
at different parts of the virtual world other than the direction the view
platform is pointing.  It sets up a different sequence of transforms that
allows the position and orientation of the image plates to follow the head
tracking sensor instead of being rigidly attached to the physical viewing
environment.

I've attached the original response that I was going to send you before I read
your latest post.  It assumes the use of HMD_VIEW, which integrates head
tracking into the viewing pipeline used for HMD devices.  If you aren't
interested in head tracking then your solution is much simpler and cleaner than
what I outline below to get around the lack of tracking.  You may be interested
in looking it over anyway since it answers some of your other questions.


> Date:         Mon, 19 Nov 2001 11:18:33 -0600
> From: Alex Terrazas <[EMAIL PROTECTED]>
>
> I would really like to get my HMD working with
> Java 3D but somehow it is eluding me.
>
> Let's begin with the non-head tracker case.
>
> Is this the recipe?
>
> 1) Set up one Canvas3D.
> 2) Set up a View
> 3) issue the View.setViewPolicy(View.HMD_VIEW); method
>
> Whenever I try #3, I get an IllegalStateException;
> HMD_MODE not supported in CYCLOPEAN_EYE_VIEW mode.

The default Canvas3D monoscopic view policy is CYCLOPEAN_EYE_VIEW.  This works
for non-stereo displays and field-sequential stereo displays where the two
stereo images are generated on the same Canvas3D.  Some HMD devices can be
driven by a single screen if the HMD supports field-sequential stereo, so the
default view policy will work for them as well if a stereo-capable Canvas3D is
used and stereo viewing is enabled.

The LEFT_EYE_VIEW and RIGHT_EYE_VIEW monoscopic view policies are intended for
generating stereo pairs on separate canvases, including the separate left and
right images used by HMD devices that accept two video channels.  The
CYCLOPEAN_EYE_VIEW policy is not valid for an HMD that requires separate
monoscopic video channels; the IllegalStateException should be a little clearer
about the reason why it was rejected.

To set up an HMD view on such a device, you need to do the following (using the
left display as an example):

Create a Canvas3D using a GraphicsConfiguration retrieved from the AWT
GraphicsDevice corresponding to the left view.  You get the array of available
GraphicsDevices from the static getScreenDevices() method of the AWT
GraphicsEnvironment class.  Since you have a dual-head card you should get two
GraphicsDevices returned in the array (if not, it's a bug in AWT; JDK 1.4.0 is
supposed to get it right, but I'm not sure if it will handle two screens from a
single card correctly).  Which is assigned to the left eye and which is
assigned to the right eye is specific to your environment.

Call the Canvas3D's setMonoscopicViewPolicy() with View.LEFT_EYE_VIEW.

Get the Screen3D associated with the Canvas3D by calling its getScreen3D()
method.  Set the physical width and physical height to the apparent width and
height in meters at the focal plane (Screen3D will otherwise assume 90
pixels/inch).  Set the HeadTrackerToLeftImagePlate transform with the matrix
that transforms points from the head tracking sensor's local coordinate system
to the image plate coordinates of the HMD left eye display.

Since you aren't currently using head tracking and are presumably not setting
the coexistence to tracker base matrix, the `head tracking sensor local
coordinate system' will be equivalent to coexistence coordinates.  In HMD mode
coexistence coordinates are also equivalent to view platform coordinates except
for the scale factor from the virtual world to the physical world established
by the View's screen scale policy (i.e, the view attach policy is ignored).  So
for a trackerless configuration the HeadTrackerToLeftImagePlate matrix
essentially transforms points from view platform coordinates to the left image
plate coordinate system, subject to the effective screen scale.

To finish up, repeat the above for the Canvas3D associated with the right eye.
You will need to create a PhysicalBody and set its HeadToHeadTracker matrix and
StereoEyeSeparation attribute to position your eyes with respect to the
displays (noting that for a trackerless configuration, head tracker coordinates
are the same as coexistence coordinates).  Then add both canvases to the View
with addCanvas3D(), set the view policy to HMD_VIEW, and set the
ScreenScalePolicy for the desired scaling.

If you decide to enable head tracking later, then you will need to define the
the HeadToHeadTracker and HeadTrackerTo{Left,Right}ImagePlate matrices to
account for the head tracking sensor's local coordinate system, and define
coexistence coordinates relative to the tracker base.

The ConfiguredUniverse example program currently available in Java 3D 1.3 beta1
doesn't include a sample configuration file for HMD devices.  I'll try to get
one together for beta2, as well as additional documentation.

-- Mark Hood

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to