Graphics.ShowActualFOV - lordmundi/wikidoctest GitHub Wiki

Using the FOV Overlay

« Adding menu items | EDGE User’s Guide | Using the doug node tcl command »

On this page… (hide)

  1. 1. Why isn’t FOV straightforward?
  2. 2. CCTV plugin enforcing aspect ratio
  3. 3. The “show” attribute
  4. 4. Running without enforcing aspect ratio
  5. 5. Should I run cctv?

1.  Why isn't FOV straightforward?

Good question. I don't know all of the history justifying all the pieces that come into play, but I know that there are quite a few, such as the cctv plugin which is meant to model real-world cameras, older GL specifications from back in the SGI days, viewport definitions and how those map to cameras, the definition of zoom factors, etc.

2.  CCTV plugin enforcing aspect ratio

The CCTV plugin does a few things, but one of the common uses is to enforce an aspect ratio of a view similar to the way a real camera view would look regardless of what viewport it was in.

For example, if you are running the cctv plugin, and you define a camera that has a "type" attribute, this will cause the cctv plugin to enforce the aspect ratio of that camera to be 4:3. You will notice that if you assign that camera to a viewport, you will see grey/gray bars on the top/bottom or sides so that the aspect ratio is enforced. For example, if we define a camera type called "GENERIC" and then create a camera of that type:

node(example_cam); type( GENERIC ); parent( CM_Cam );

Now, assigning that camera to a viewport should cause the 4:3 aspect ratio to be preserved (as long as the cctv plugin is indeed running - you can check to see what plugins are loaded by looking under Help→About→Plugins). Resizing the window to make the viewport change shape should make this more obvious.

3.  The "show" attribute

Another trigger for the cctv plugin to enforce aspect ratio can be the use of the "show" attribute in the camera definition. This "show" capability is the feature that will give us access to the true HFOV. For example, lets define the camera differently:

node(example_cam); parent( CM_Cam ); show( FOV );

Now re-run EDGE and assign that new camera. You should see a HFOV overlay in the upper corner. This represents the true HFOV.

4.  Running without enforcing aspect ratio

You may have noticed that the camera is also enforcing the aspect ratio since we triggered the cctv plugin to do so with the "show" attribute. However, this does not mean that you can't use the "show" attributes without the cctv plugin. Try removing the cctv plugin and you will notice that the overlay still shows up but the aspect ratio is no longer being enforced: the camera view will fill the viewport however it is stretched. Furthermore, you should notice that the HFOV overlay value changes as the viewport stretches!! Even though the HFOV parameter for the camera node is not changing (which can be seen with the node edit dialog), the actual FOV is changing since the viewport is being resized. This is why we refer to the value in the overlay as the actual HFOV.

5.  Should I run cctv?

Most times you will want to run the cctv plugin since you can still define non-real-world cameras that do stretch with the viewport (such as CM_Cam), but probably want to restrict the aspect ration for real cameras. Use the "show(FOV)" attribute to help visualize the actual HFOV for these cameras.

« Adding menu items | EDGE User’s Guide | Using the doug node tcl command »