View Blog (restored)

Everything DG Kernel: Technical discussions and issues
Post Reply
Nick
Site Admin
Posts: 19
Joined: Fri Jun 14, 2024 12:35 am

View Blog (restored)

Post by Nick »

In this thread I would like to expand more informally concepts related to interactive view manipulation and its programming. See also Concepts of 3D Graphics

The best way to understand it is probably to open any sample (View Point or Zoom are good to see the programmatic manipulation) and play with the
Birds Eye view a little why reading.

The core concept of View Volume is simple. You need to define which part of the world is displayed on the screen. It is determined by the View Volume which is simply an arbitrary oriented 3D box.

Whatever is inside the box is projected to the front side of the box, converted to pixels and this is what you get in the DGK window.

The view manipulations, either interactively with mouse or in code, are simply manipulations of position, orientation and size of the box. Zoom in, for example, is reduction of size of the view volume without changing anything else.

For case of perspective projection, the difference is minor in my view: Instead of a box you get a frustum, which is a slightly distorted box, but later about that.

More to follow...
Nick
Site Admin
Posts: 19
Joined: Fri Jun 14, 2024 12:35 am

Programming

Post by Nick »

More precisely View Volume is defined as a box (three ranges) aligned to a set of axes (frame) called Eye Frame.

To access and manipulate Eye Frame use
dgk > GetView() > IView_DG > IView_DG.GetEyeFrame() > IFrame_DG.

For an example, Calls to IFrame_DG.Translate() on the interface will result in pan.

IView_DG.ViewingVolume property defines the three local to eye frame ranges of the View Volume.

Normally it is more convenient to use higher level methods of manipulating View Volume. IView_DG.Reset() is the most frequent operation to fit the scene into the view with default initial rotations to show the scene at some angle.

See also IView_DG.GoTo(), IView_DG.LookAtEntity(), etc.

Remember to call IView_DG.Update() or dkg.UpdateView() to repaint the window after series of manipulations.

Direct manipulation of ranges of the View Volume needs attention to keeping x and y ranges (horizontal and vertical) to have the same aspect range as the window. During modification, the component adjusts the input, when necessary, to make sure it is true.

Depth range (z range) is also little tricky. More on this in the next post
Nick
Site Admin
Posts: 19
Joined: Fri Jun 14, 2024 12:35 am

Depth zoom

Post by Nick »

Part of the scene outside the Z range of the View Volume is rendered, do it is not visible. Normally the range should include al objects, otherwise it can be very confusing.

Making the range too long is not good as it changes center of the viewing rotations which navigating interactively. It also reduces precision of surface point selection. For these reasons the depth range is updated automatically very frequently to include all objects with some extra room for rotations.

Sometimes with very clattered scene, like analyzing problems with mesh in high zoom, it is useful to reduce the range to cut off the part before or behind the focus area. For this there is depth zoom functionality.

Changing depth zoom in the code is possible, but it is better to avoid it.
Nick
Site Admin
Posts: 19
Joined: Fri Jun 14, 2024 12:35 am

Advanced

Post by Nick »

For completeness: We do not use Camera concept often mentioned in literature and graphical software. We believe it a secondary notion coming from some traditions. View Volume is clearer and more convenient for both interaction and programming, in our view ( :? :lol: ).
Post Reply