View Issue Details

IDProjectCategoryView StatusLast Update
0018942Open CASCADEOCCT:Visualizationpublic2014-11-11 13:03
ReportersanAssigned Tosan 
PrioritynormalSeverityfeature 
Status closedResolutionduplicate 
OSAll 
Target Version6.8.0Fixed in Version6.8.0 
Summary0018942: Improved perspective in OCCT 3D view
DescriptionInitial context: see IFMT id=213

After some analysis, it has become obvious that the current perspective view
implementation in OCCT is satisfactory. The main problem is absence of
documentation of OCCT API related to perspective view set-up.

Therefore, it is necessary to:
1. Analyze and debug (if necessary) the current implementation of perspective
view, including projection and selection classes.

2. Summarize the results of this analysis in OCCT reference documentation
(improved CDL comments) and OCCT Visualization User's Guide. Improved
documentation should include:
- Illustrated description of all OCCT perspective definition parameters.
- Correspdondence between high-level API and low-level API parameters
- Calculation of "classic" OpenGL-style projection matrix (or projection
parameters: znear, zfar, top, bottom, left, right) starting from these
parameters.
- Examples of initial perspective setup, hints on choosing suitable values of
parameters.
- Description of typical problems reuslted from prespective API misuse
(perpsective distortion lost after "Z fit" and after interactive rotation,
etc.) and hints on how to avoid them.

Results of this improvement should be approved by SD projects that include
perspective view as a mandatory feature.
Additional information
and documentation updates
Documentation remark, added by SAN 2008-07-23 14:24:40:

New features:
Prior to OCCT 6.3 release, perspective view was quasi-static. That is, a 3D
scene was displayed in a perspective view as if the camers (or eye) was fixed
in the view reference coordinate system and did not move during panning.
Instead of moving the camera (eye) with respect to the model, panning moved
the viewport through which a part of the static perspective picture was
exposed to the user.

Meanwhile, such behavior often does not match the user expectations concerning
perspective view. Typically, it is desirable that panning moves the camera
(eye) with respect to the model, simulating "a flight" over the model.

In OCCT 6.3, such new perspective projection mode (called "symmetric
perspective") has been introduced in addition to the existing perspective view
features. The word "symmetric" means that the perspective viewing frustum is
always symmetric with respect to the camera (eye), and it moves during panning
operation.

The symmetric perpsective projection is activated by defining
CSF_SYM_PERSPECTIVE environment variable. By default, the old perspective view
behavior is active, to ensure backward compatibility. However, in further OCCT
releases the symmetric perspective projection might fully replace the old
perpsective view behavior.

Note that in the future V3d_TPM_WALKTHROUGH projection model might become
obsolete, as it has no obvious benefits against V3d_TPM_SCREEN one and at the
same time complicates the source code significantly.
Improvements:
Apart from the new "symmetric perspective projection" mode, the following
convenient methods have been added to V3d API in order to facilitate
definition of perspective view parameters:

- V3d_View::DepthFitAll(Aspect,Margin): adjusts Z size and depth of a 3D view
automatically so as not to clip the displayed objects by front and back
clipping planes. Depth is Aspect / 2 times smaller than the new Z size, that
allows achieving required perspective effect easily.

- V3d_View::SetViewingVolume(Left,Right,Bottom,Top,ZNear,ZFar): allows
defining viewing volume parameters in OpenGL-like manner (see glFrustum() and
glOrtho() functions). It computes view orientation and mapping parameters on a
basis of its arguments, depending on the view type (orthographic or
perspective).

- V3d_PerspectiveView::SetPerspective(Angle,UVRation,ZNear,ZFar): convenient
function that works similarly to gluPerspective(). It calculates view
orientation and mapping parameters on a basis of its arguments.

Low-level part of OCCT visualization that concerns working with view
orientation (MODELVIEW) and mapping (PROJECTION) matrices has been simplified.
Since OCCT 6.3 these matrices are calculated in a single source file
(OpenGl_view.c). The matrices calculated here are re-used by OpenGL
visualization, interactive detection and selection and auxiliary algorithms
such as "fit all" operation. In further OCCT versions, this refinement might
be continued in part concerning the code that projects 3D points onto the
viewport.

In case if the old and new V3d API still does not allow some application to
achieve the required view orientation and mapping beavior, it is possible to
fully control the MODLEVIEW and PROJECTION matrices at the application level
by means of Visual3d_ViewOrientation::SetCustomModelViewMatrix() and
Visual3d_ViewMapping::SetCustomProjectionMatrix() methods. These matrices are
not recomputed by OCCT visualization angine and are used everywhere instead of
the ones calculated by OCCT.
Public access to view orientation and mapping classes has been provided in
V3d_View class in order to satisfy most complicated development needs related
to viewing.

OCCT Visualization User's Guide has been amended by detailed description of
view definition parameters. The recommended parameter values suitable in most
typical cases are given.

Modified entities:
V3d package

V3d_View class: DepthFitAll(), SetViewingVolume(), ConvertWithProj(),
SetViewMapping(), ViewMapping(), SetViewOrientation() and ViewOrientation()
methods added
V3d_PerspectiveView class: SetPerspective() method added

Visual3d package

Visual3d_ViewMapping class: SetCustomProjectionMatrix() and IsCustomMatrix()
methods added
Visual3d_ViewOrientation class: SetCustomModelViewMatrix() and IsCustomMatrix
() methods added
TagsNo tags attached.
Test case number

Attached Files

Activities

2008-07-22 17:33

 

san-OCC18492-v1.tar.gz (130,514 bytes)

2008-07-23 12:46

 

san-OCC18942-v2.tar.gz (136,376 bytes)

2008-07-23 14:24

 

visu_p524.doc (62,464 bytes)

2008-08-13 09:03

 

V3d_View.cxx (108,963 bytes)

2008-08-20 16:02

 

OCC18492-vtn.zip (24,645 bytes)

kgv

2014-02-05 15:13

developer   ~0027782

Dear bugmaster,

please close the issue since it has been solved within patch for #0024001.

Issue History

Date Modified Username Field Change
2008-02-08 19:12 bugmaster Assigned To bugmaster => nkv
2008-02-08 19:12 bugmaster Status new => assigned
2008-07-23 14:47 san Assigned To nkv => san
2008-07-23 16:25 san Status assigned => resolved
2008-07-25 17:58 mkv Status resolved => tested
2008-08-13 11:11 ptv CC => ptv, abv
2008-08-20 18:09 vtn Status tested => assigned
2008-08-22 12:29 bugmaster Status assigned => tested
2008-08-26 16:34 bugmaster Status tested => verified
2009-06-23 19:00 bugmaster Status verified => closed
2009-06-23 19:00 bugmaster Resolution @0@ => fixed
2009-09-23 11:52 bugmaster Assigned To san => bugmaster
2009-09-23 11:52 bugmaster Status closed => assigned
2009-09-23 11:52 bugmaster Resolution fixed => @0@
2009-09-23 11:52 bugmaster Assigned To bugmaster => kgv
2011-08-02 11:24 bugmaster Category OCCT:VIZ => OCCT:Visualization
2012-01-11 12:24 atp Description Updated
2012-01-11 12:24 atp Additional Information Updated
2012-01-18 05:03 abv Description Updated
2013-06-11 08:07 kgv Assigned To kgv => apl
2013-10-10 09:37 apl Assigned To apl => duv
2014-02-05 15:13 kgv Note Added: 0027782
2014-02-05 15:13 kgv Assigned To duv => bugmaster
2014-02-05 15:13 kgv Status assigned => feedback
2014-02-05 15:13 kgv Resolution open => duplicate
2014-02-05 15:13 kgv Target Version => 6.7.1
2014-02-05 15:47 bugmaster Status feedback => closed
2014-02-05 15:47 bugmaster Assigned To bugmaster => san
2014-02-05 15:47 bugmaster Fixed in Version 6.3.0 => 6.7.1
2014-04-08 14:51 abv Status closed => feedback
2014-04-08 14:51 abv Fixed in Version 6.7.1 => 6.8.0
2014-04-08 14:51 abv Target Version 6.7.1 => 6.8.0
2014-04-08 14:57 abv Status feedback => tested
2014-04-08 14:57 abv Status tested => verified
2014-11-11 13:03 aiv Status verified => closed