📄 viewmodel.html
字号:
<ul> <font size="-1"><b><i>Figure 10</i> – A Three-Screen DisplayEnvironment</b></font></ul><p>A multiple-screen environment requires more care during theinitialization and calibration phase. Java 3D must know how theScreen3Ds are placed with respect to one another, the tracking device,and the physical portion of the coexistence coordinate system.</p><p></p><h2>Viewing in Head-Tracked Environments</h2><p>The "<a href="#Generating_View">Generating a View</a>" sectiondescribes how Java 3D generates a view for a standard flat-screendisplay with no head tracking. In this section, we describe howJava 3Dgenerates a view in a room-mounted, head-tracked displayenvironment-either a computer monitor with shutter glasses and headtracking or a multiple-wall display with head-tracked shutter glasses.Finally, we describe how Java 3D generates view matrices in ahead-mounted and head-tracked display environment.</p><h3>A Room-Mounted Display withHead Tracking</h3>When head tracking combines with a room-mounteddisplay environment (for example, a standard flat-screen display), theViewPlatform's origin and orientation serve as a base for constructingthe view matrices. Additionally, Java 3D uses the end-user's headposition and orientation to compute where an end-user's eyes arelocated in physical space. Each eye's position serves to offset thecorresponding virtual eye's position relative to the ViewPlatform'sorigin. Each eye's position also serves to specify that eye's frustumsince the eye's position relative to a Screen3D uniquely specifies thateye's view frustum. Note that Java 3D will access the PhysicalBodyobject to obtain information describing the user's interpupilarydistance and tracking hardware, values it needs to compute theend-user's eye positions from the head position information.<h3>A Head-Mounted Display withHead Tracking</h3>In a head-mounted environment, the ViewPlatform's origin andorientation also serves as a base for constructing view matrices. And,as in the head-tracked, room-mounted environment, Java 3D alsouses theend-user's head position and orientation to modify the ViewPlatform'sposition and orientation further. In a head-tracked, head-mounteddisplay environment, an end-user's eyes do not move relative to theirrespective display screens, rather, the display screens move relativeto the virtual environment. A rotation of the head by an end user canradically affect the final view's orientation. In this situation, Java3D combines the position and orientation from the ViewPlatform with theposition and orientation from the head tracker to form the view matrix.The view frustum, however, does not change since the user's eyes do notmove relative to their respective display screen, so Java 3D cancompute the projection matrix once and cache the result.<p>If any of the parameters of a View object are updated, this willeffecta change in the implicit viewing transform (and thus image) of anyCanvas3D that references that View object.</p><p></p><h2>Compatibility Mode</h2><p>A camera-based view model allows application programmers to thinkaboutthe images displayed on the computer screen as if a virtual camera tookthose images. Such a view model allows application programmers toposition and orient a virtual camera within a virtual scene, tomanipulate some parameters of the virtual camera's lens (specify itsfield of view), and to specify the locations of the near and farclipping planes.</p><p>Java 3D allows applications to enable compatibility mode forroom-mounted, non-head-tracked display environments or to disablecompatibility mode using the following methods. Camera-based viewingfunctions are available only in compatibility mode. The <code>setCompatibilityModeEnable</code>method turns compatibility mode on or off. Compatibility mode isdisabled by default.</p><hr noshade="noshade"><p><b>Note:</b> Use of these view-compatibilityfunctions will disable some of Java 3D's view model features andlimitthe portability of Java 3D programs. These methods are primarilyintended to help jump-start porting of existing applications.</p><hr noshade="noshade"><h3>Overview of theCamera-Based View Model</h3>The traditional camera-based view model, shown in <a href="#Figure_11">Figure11</a>,places a virtual camera inside a geometrically specified world. Thecamera "captures" the view from its current location, orientation, andperspective. The visualization system then draws that view on theuser's display device. The application controls the view by moving thevirtual camera to a new location, by changing its orientation, bychanging its field of view, or by controlling some other cameraparameter.<p>The various parameters that users control in acamera-based view model specify the shape of a viewing volume (known asa frustum because of its truncated pyramidal shape) and locate thatfrustum within the virtual environment. The rendering pipeline uses thefrustum to decide which objects to draw on the display screen. Therendering pipeline does not draw objects outside the view frustum, andit clips (partially draws) objects that intersect the frustum'sboundaries.</p><p>Though a view frustum's specification may have many items in commonwith those of a physical camera, such as placement, orientation, andlens settings, some frustum parameters have no physical analog. Mostnoticeably, a frustum has two parameters not found on a physicalcamera: the near and far clipping planes.</p><p><a name="Figure_11"></a><img style="width: 500px; height: 202px;" alt="Camera-Based View Model" title="Camera-Based View Model" src="ViewModel11.gif"></p><p></p><ul> <font size="-1"><b><i>Figure 11</i> – The Camera-Based View Model</b></font></ul><p>The location of the near and far clipping planes allows the applicationprogrammer to specify which objects Java 3D should not draw.Objectstoo far away from the current eyepoint usually do not result ininteresting images. Those too close to the eyepoint might obscure theinteresting objects. By carefully specifying near and far clippingplanes, an application programmer can control which objects therenderer will not be drawing.</p><p>From the perspective of the display device, the virtual camera'simageplane corresponds to the display screen. The camera's placement,orientation, and field of view determine the shape of the view frustum.</p><p></p><h3>Using the Camera-Based ViewModel</h3><p>The camera-based view model allows Java 3D to bridge the gapbetweenexisting 3D code and Java 3D's view model. By using thecamera-basedview model methods, a programmer retains the familiarity of the olderview model but gains some of the flexibility afforded by Java 3D'snewview model.</p><p>The traditional camera-based view model is supported in Java 3Dbyhelping methods in the Transform3D object. These methods wereexplicitly designed to resemble as closely as possible the viewfunctions of older packages and thus should be familiar to most 3Dprogrammers. The resulting Transform3D objects can be used to setcompatibility-mode transforms in the View object.</p><p></p><h4>Creating a Viewing Matrix</h4><p>The Transform3D object provides a <code>lookAt</code> utilitymethodto create aviewing matrix. This method specifies the position and orientation ofa viewing transform. It works similarly to the equivalent function inOpenGL. The inverse of this transform can be used to control theViewPlatform object within the scene graph. Alternatively, thistransform can be passed directly to the View's <code>VpcToEc</code>transform via the compatibility-mode viewing functions. The <code>setVpcToEc</code><code></code>method is used to set the viewing matrix when in compatibility mode.</p><h4>Creating a ProjectionMatrix</h4><p>The Transform3D object provides three methods forcreating a projection matrix: <code>frustum</code>, <code>perspective</code>,and <code>ortho</code>. All three map points from eye coordinates(EC) to clipping coordinates (CC). Eye coordinates are defined suchthat (0, 0, 0) is at the eye and the projection plane is at <em>z</em>= -1.<br></p><p>The <code>frustum</code> methodestablishes a perspective projection with the eye at the apex of asymmetric view frustum. The transform maps points from eye coordinatesto clipping coordinates. The clipping coordinates generated by theresulting transform are in a right-handed coordinate system (as are allother coordinate systems in Java 3D).</p><p>The arguments define the frustum and its associated perspectiveprojection: <code>(left</code>, <code>bottom</code>, <code>-near)</code>and <code>(right</code>, <code>top</code>, <code>-near)</code>specify the point on the near clipping plane that maps onto thelower-left and upper-right corners of the window, respectively. The <code>-far</code>parameter specifies the far clipping plane. See <a href="#Figure_12">Figure12</a>.</p><p>The <code>perspective</code> method establishes a perspectiveprojection with the eye at the apex of a symmetric view frustum,centered about the <em>Z</em>-axis,with a fixed field of view. The resulting perspective projectiontransform mimics a standard camera-based view model. The transform mapspoints from eye coordinates to clipping coordinates. The clippingcoordinates generated by the resulting transform are in a right-handedcoordinate system.</p><p>The arguments define the frustum and its associated perspectiveprojection: <code>-near</code> and <code>-far</code> specify the nearand far clipping planes; <code>fovx</code> specifies the field of viewin the <em>X</em> dimension, in radians; and <code>aspect</code>specifies the aspect ratio of the window. See <a href="#Figure_13">Figure13</a>.</p><p><a name="Figure_12"></a><img style="width: 500px; height: 209px;" alt="Perspective Viewing Frustum" title="Perspective Viewing Frustum" src="ViewModel12.gif"></p><p></p><ul> <font size="-1"><b><i>Figure 12</i> – A Perspective Viewing Frustum</b></font></ul><p><a name="Figure_13"></a><img style="width: 500px; height: 212px;" alt="Perspective View Model Arguments" title="Perspective View Model Arguments" src="ViewModel13.gif"></p><p></p><ul> <font size="-1"><b><i>Figure 13</i> – Perspective View Model Arguments</b></font></ul><p>The <code>ortho</code> methodestablishes a parallel projection. The orthographic projectiontransform mimics a standard camera-based video model. The transformmaps points from eye coordinates to clipping coordinates. The clippingcoordinates generated by the resulting transform are in a right-handedcoordinate system.</p><p>The arguments define a rectangular box used for projection: <code>(left</code>,<code>bottom</code>, <code>-near)</code> and <code>(right</code>, <code>top</code>,<code>-near)</code>specify the point on the near clipping plane that maps onto thelower-left and upper-right corners of the window, respectively. The <code>-far</code>parameter specifies the far clipping plane. See <a href="#Figure_14">Figure14</a>.</p><p><a name="Figure_14"></a><img style="width: 500px; height: 220px;" alt="Orthographic View Model" title="Orthographic View Model" src="ViewModel14.gif"></p><p></p><ul> <font size="-1"><b><i>Figure 14</i> – Orthographic View Model</b></font></ul><p></p><p>The <code>setLeftProjection</code>and <code>setRightProjection</code> methods are used to set theprojection matrices for the left eye and right eye, respectively, whenin compatibility mode.</p></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -