Documentation for UE Model Viewer
This is the documentation for the Unreal Engine 4 Model Viewer, which is an application designed to allow high quality renders of 3D models to be loaded, lit, and rendered in high quality. The Model Viewer is compatible with Windows machines with reasonably modern graphics hardware.
Table of contents
Fig 1. The Model Viewer Interface
Upon opening the Model Viewer application, you will be greeted with a black screen. The first thing to do is load in a model to be viewed. To do this, click on the "Open File" button in Section B of the image above. A standard file dialog will be opened, which you can use to navigate to the desired file. The following file types are supported: 3DS, BLEND, DAE/Collada, FBX, FC-STEP, ASE, DXF, HMP, MD2, MD3, MD5, MDC, MDL, NFF, PLY, STL, X, OBJ, OpenGEX, SMD, LWO, LXO, LWS, TER, AC3D, MS3D, COB, Q3BSP, XGL, CSM, BVH, B3D, NDO, Ogre Binary, Ogre XML, Q3D, ASSBIN (Assimp custom format), glTF (partial), and 3MF. For texture loading, please see the Texture Loading section.
Once your model has been loaded, some lights will be required to see it! There are 3 main lighting options available, accessible in Section A. The HDRI lighting, which can be activated via clicking the "Toggle HDRI Light" button, is the simplest solution to light the scene, as it uses a cubemap to light the model. You can select from 4 HDRI backgrounds with the drop down next to the "Toggle HDRI Light" button. For more specific control, you have the option to add direction and point lights to the scene via their respective buttons, "Add Point Light" and "Add Directional Light". These lights can be removed by clicking on them, then clicking "Remove Selected" or hitting the DEL key. Clicking on a light will also bring up the Color wheel, seen in Section D. This can be used to control the color and intensity of the lights.
The camera can be rotated around the center of the scene by holding LEFT CLICK and dragging the mouse. The camera can also be zoomed in and out by use of SCROLL WHEEL UP and SCROLL WHEEL DOWN. Additional camera options can be accessed by using the T key to toggle freecam mode. In freecam mode, W, A, S, and D can be used to move forward, back, down, and up respectively. The look direction can be adjusted by holding LEFT CLICK and dragging the mouse. Pressing the T key again will disable freecam mode. Finally, pressing P will toggle between Perspective and Orthographic view modes.
Clicking on an object (model or light) will cause the manipulation gizmo to appear (Section E). The gizmo can be used to translate, rotate, or scale the object. Using LEFT CLICK and drag on the center of the gizmo allows free movement, and clicking on an arrow allows constrained movement. The controls located in Section C provide additional options to manipulate the objections. The Current Transform drop down box allows to translation, rotation, or scaling to be selected, and the Snapping settings boxes allow for manipulations to be snapped to set intervals.
Once your scene has been set up as desired, the final rendering can be produced by clicking on the "Render Image" button found in Section B. A file dialog will be opened prompting for a file location to be chosen. The final image will be rendered as a PNG. Next to the "Render Image" button is the resolution scale dropdown. By default, it is 1x, which is the resolution of the application. By selecting higher scales using the dropdown, higher resolution renders can be produced. For example, if your application is being run in standard 1080p, a 7680 x 4320 image can be produced by selecting 4x.
This application is based in Unreal Engine 4, version 4.25. The application was developed on Windows 10. Non-default Unreal plugins used are Color Wheel version 2020.1.4, Easy File Dialog version 2.0, RuntimeMeshImportExport version 1.11, and RuntimeTransformer version 1.0. The application uses Unreal Engine 4's Raytracing features to produce high quality images.
Model loading is done through use of the RuntimeMeshImportExport Unreal Engine Plugin, which enables models to be loaded at runtime from the user's PC. The plugin allows for files of a variety of formats, and theoretically has texture support, though the files we tested on didn't appear to work. See Fig 2. for a the Blueprint Implementation. We ended up using a workaround for texture loading, detailed below. Point cloud loading is also supported, but isn't a focus of the application.
Because of the difficulty with getting correctly formatted files to be loaded by the RuntimeMeshImportExport Plugin, we instead opted for a practical solution of expecting the textures to be located in the same folder as the model file with a particular suffix. Specifically, the model viewer can load in a diffuse, specular, and normal texture along with the model. The suffixes are "-DIFFUSE", "-SPECULAR" and "-NORMAL" respectively. An example of a proper folder setup can be seen in Fig 3.
File dialogs are used to make locating the files to be loaded much simpler. This is accomplished in a very straightforward manner using the File Dialog plugin, which allows for string filepaths to easy be obtained for use by the RuntimeMeshImportExport plugin.
The camera control utilizes Unreal's built in camera options. A spring arm component is used to achieve the standard camera behavior, of rotation around a center point. Additionally, free camera and perspective toggles were added to make the camera usage experience more intuitive. The free camera simple uncouples the camera from the spring arm component, and perspective toggle is done trivially by editing the camera settings. A cinecamera was used over a standard camera, as it provides extra options in terms of aspect ratio, depth of field, and other cinematic effects.
The three types of lights in use by the Model Viewer are point, directional, and HDRI. HDRI is the most generally useful, as it provides a good looking background and realistic looking ambient light. It uses a cubemap to define the environment, and is implemented through Unreal's built in HDRIbackdrop. The point and directional lights are handled through spawning a point or directional light actor into the environment, but of course they are not useful without a method of moving them, as detailed below.
To allow for the scene to be manipulated, we used the RuntimeTransformer plugin, which provides editor-style movement gizmos to be used to manipulate objects in the scene, in our case lights and loaded models. The blueprint allows for objects to be selected via clicking and dragged.
We use the Color Wheel plugin to allow the color of the lights to be changed dynamically. The plugin is simple to use, and the color wheel menu, only shows when a relevant object (i.e. light) is selected.
The User Interface is a simple but effective use of Unreal's UI Widget system. Fig 4. shows the setup used for the widget. The buttons trigger events that are executed in the level blueprint, allow the user easy and intuitive access to the core functionality of the Model Viewer.
The Gizmo interface is separate from the main user interface, and interacts only with the Gizmo controls. These are based heavily on the example blueprints provided by the RuntimeTransformer plugin. The Gizmo interface can be seen at section C of Fig. 1. It provides rotation, translation, scale, and snapping settings.
Output rendering is done through Unreal's HighResShot console command, which allows for renders to be create at any resolution. The Model Viewer provides the user the option to select an output location through the Easy File Dialog plugin, and to select a multiplier for the output resolution. Though the process for obtaining a screenshot is theoretically simple, a lot of code is required to make sure the output image is presentable. Particularly, all lights placeholder meshes, gizmos, and UI needs to be absent in the final image. To this end, all light meshes are made invisible during the render, and reenabled after, and the currently selected object is deselected. This process can be seen in Fig 5. There are several alternative methods that we explored before arriving at HighResShot, that could work for other similar projects. The Movie Render Queue is a very high quality option, but is only available at runtime in Unreal 4.26+. Another option explored was NVIDIA Ansel, which is a very powerful tool but is unfortunately incompatible with Unreal Raytracing and AMD hardware.
Fig 2. Model Loading Blueprint
Fig 3. Proper Texture Folder Setup
Fig 4. The UI Widget
Fig 5. The Rendering Blueprint