WarningYour internet explorer is in compatibility mode and may not be displaying the website correctly.
You can fix this by pressing 'F12' on your keyboard, Selecting 'Document Mode' and choosing 'standards' (or the latest version
listed if standards is not an option).

The Graphics Window: Effective and Beautiful Postprocessing

Using the Graphics window in COMSOL Multiphysics can be a little tricky if you’re not too familiar with what it can do. But once you know the shortcuts, controlling the camera and view angles to create good graphics becomes quite straightforward. I hope the techniques shown here will help you produce graphics to visualize and present your work more easily.

The View Node Has Everything You Need

Even if you have spent plenty of time creating geometry, setting up models, and solving studies, the tools for arranging the Graphics window may still be a mystery to you.

We’ll start with the View node, one of the most important features in the graphics tools. This node is in the Model Builder under “Definitions”. A single View node is automatically added when you create the first component in a model, but you can add more than one by right-clicking the Definitions node and choosing View. Having multiple View nodes lets you set up different perspectives of your model component’s geometry, which you can display in your results, and switch between them as needed. In the View node, you may also add and remove different types of lights, and change their colors and positions.

In the View settings, you can control certain general effects (shown below), such as the overall light intensity, transparency, and whether a grid or coordinate system is shown.

Using the Camera

One of my favorite features of the View node is the camera. The Camera settings control the angle, position, zoom, and perspective of the camera, which correspondingly changes the view of the component geometry displayed in the Graphics window. Using the mouse and keyboard shortcuts that control the position of the camera is one of the most efficient ways to set up a good shot. One way to imagine the camera is to picture a physical camera sitting in front of the component geometry — the scene. When you look at the object, you’re looking straight through the camera’s viewfinder at the scene, which is displayed in the Graphics window.

This means that when you move something in the Graphics window, you’re actually moving the camera, not the geometry itself, unless you are performing a geometry operation. Here’s what the Camera settings look like:

Let’s run through a few of the settings shown above.

Zoom angle

This is exactly what it sounds like; the Zoom angle setting controls the zoom of the camera lens.

Position

This refers to the location of the camera, not the geometry object or scene. For instance, in the earlier image, the camera is located at coordinates (-3,-4,3).

Target

This sets the target location, or where the camera is “looking”. For instance, a target of (0,0,0) means that the camera is aimed directly at the point (0,0,0).

Another way to think about this setting is that it creates an axis through the center of the camera and the Target coordinates.

Up Vector

This setting controls the direction of the camera’s up vector in relation to what is “up” in the model component or scene. An up vector of (1,0,0) tells you that you have tilted the camera 90 degrees and the camera’s up vector is running along the scene’s x-axis. The images below are examples of how changes to the camera’s Up Vector are reflected in the triad that shows the direction of the axis in the geometry, which is also the scene’s axis.

Left, up vector set to (0,0,1); center, up vector set to (1,0,1); right, up vector set to (1,0,0).

View Offset

This setting moves the visible frame that the object sits in around on a plane that is parallel to the current Graphics window view (this does not refer to the X-Y plane in the geometry’s coordinate system). The input values are relative to the size of the Graphics window — for instance, an x-value of 0.25 will move the scene in the camera’s viewfinder in the positive x-direction by 25% of the width of the Graphics window.

Camera Shortcuts

Now, let’s dive into positioning the camera to get the look you want. Unless you have incredibly good spatial awareness that translates into knowing what coordinates to enter in the camera settings (in which case, please teach me that trick), you’ll want to use the mouse and keyboard shortcuts to position the view.

Note: For our Mac users, a couple of these shortcuts will only work on a two-button mouse or a mouse with a center button.

This first shortcut is very simple, but also very useful: it moves the visible frame left, right, up, or down on the camera’s viewfinders plane, the plane of the Graphics window. This changes the View Offset as we described earlier.

One of my favorites, this shortcut rotates the camera around an axis perpendicular to the plane of the Graphics window:

Another “very simple but very useful” action is zooming in on the area where the mouse is located. While the zoom buttons in the graphics tools are quick and easy, they zoom in on the center of the visible window by specific increments. This mouse action gives you more precise control over the zoom angle.

The next shortcut changes the pan and tilt of the camera. This effect changes the position and angle at which the camera sees the component geometry (in contrast to the movement in Action 1, where the visible frame moves around in the camera’s viewfinder plane). The orange icon indicates the direction of the camera. Since this shortcut moves and rotates the camera with respect to the component geometry, the model will appear to move in the opposite direction of the mouse.

Moving the camera up, down, left, and right (“pedestal” and “track,” if you’re in the movie business) is pretty easy once you know the trick. This shortcut moves the camera, but keeps it facing the same direction — like Action 4, this gives a slightly different and more realistic perspective than simply moving the visible frame on the Graphics window plane. This shortcut also moves the camera with respect to the component’s geometry. Therefore, the geometry will appear to move in the opposite direction of the camera.

This last shortcut keeps the component geometry in the center of the camera view, but dollies the camera in and out (forward and back) from the center of the view. Unlike zooming, it is not affected by the location of the mouse, nor does this action change the zoom angle of the lens. You can get really cool perspectives by first zooming out (Action 3) and then using the dolly shortcut to roll towards the scene.

Voilá! These are a few ways you can position your camera around the component geometry to arrange beautiful graphics. Next, let’s examine how you can get an inside look at your component.

Invisibility Cloaking: How to Hide Entities

Sometimes, when you’re displaying a geometry in 3D, you might have to hide a boundary or even a whole domain to get a good look at what’s going on inside, especially in cases where Wireframe Rendering is not an option. A common example of this is a complex model geometry with an air domain around it — the air is usually represented by a finite box. Chances are, you don’t want to see the box when you set up your results.

At other times, you may want a view that displays the inner parts of a component’s geometry. The COMSOL Multiphysics graphics tools offer several ways to hide parts of a model. We’ll continue using the View node, where you can choose to hide objects or entities.

Note: There is also an option to Hide Geometric Objects, which hides objects created by a geometry feature. Hiding geometry objects only applies in certain nodes, when you click the Geometry node and then the View or Definitions nodes, for example. As soon as you click Materials, Physics, or any other branch below Geometry in the Model Builder, the Graphics window displays geometric entities instead. Actions that hide geometric objects are not reflected in the Materials, Physics, Mesh and Results nodes, so Hide Geometric Entities is preferable when you are not working in the Geometry branch of the model tree.

As an example, let’s take another look at the busbar model. Suppose you want to hide one of the side faces and the top face of the horizontal extrusion, so that you can see the bolts inside. For this, pick Boundary as the geometric entity level. Click on each of the faces you want to hide to select them (they’ll turn purple).

If you click the View node again, you’ll still see the model, but your chosen boundaries are now invisible:

If you want your results to show this view, select the plot group you want to apply it to. Under Plot Settings (below), select the view you’ve been working in (this is View 5 in our example), which will cause the plot results to update.

Here’s what the results look like now:

In the view above, I’ve also hidden one of the front edges. Since you can’t select more than one type of entity to hide in a single node, I created another Hide Geometric Entities node for hiding edges, and selected the long edge at the front, which is now invisible.

Conclusion and Next Steps

Now that you’re more familiar with camera positioning, keyboard and mouse shortcuts, and hiding entities, you’ll be able create the visual results you want using the graphics tools. You can read more about using the Graphics window in the COMSOL Documentation, which is accessible from COMSOL Multiphysics under File > Help, or by pressing Ctrl+F1.

Microsoft and Windows are registered trademarks of Microsoft Corporation in the United States and/or other countries. Mac is a trademark of Apple Inc., registered in the U.S. and other countries. Linux is a registered trademark of Linus Torvalds.