Skip to content

5 ‐ 3D Models

ashtongilbert56 edited this page Nov 4, 2023 · 13 revisions

A. Importing STL Models

Screenshot 2023-11-01 at 2 30 21 PM

  • Extract the downloaded folder to access the STL file

  • In order to use an STLModels need to be converted to a .glb file type. Some programs that can convert 3D models to the .glb file type include:

  • Paint 3D
  • Microsoft Paint 3D
  • Microsoft Remix 3D
  • Blender
  • Trimble 3D Warehouse
  • SketchUp There are also many website that can be used to perform the conversion. For example, https://fabconvert.com/convert/stl/to/glb
  • We will convert an F-16 STL to GLB using Paint 3D as an example.

  • Open the model in Paint3D

Screenshot 2023-11-01 at 2 31 03 PM

  • Then, save the model. ‘Menu’ -> ‘Save as’ -> ‘3D Model’

Screenshot 2023-11-01 at 2 31 43 PM

  • Then, select to save as a .glb file type.

Screenshot 2023-11-01 at 2 32 09 PM

  • Once the file is in .glb format, it can be added to the Unreal Engine project.

  • Open the Content Browser by pushing 'CTRL + Spacebar'

  • Navigate to the All -> Content -> Blueprints Folder

  • Drag the .glb file into this folder.

Screenshot 2023-11-01 at 2 44 22 PM

  • Once it appears in that folder, open your vehicle blueprint and click on the Viewport tab towards the top. Then, drag the model into the blueprint viewport window. You should now see the model.

Screenshot 2023-11-01 at 2 46 15 PM


B. Scaling, Rotating, and Origin

  • It's likely your vehicle was imported at the wrong size and orientation with a wrong origin.
  • First, let's look at the model's scale and orientation.

Scale and Orientation

  • We can change aspects of the model such as scale, rotation, and location from the details menu on the right side after clicking on the model.
  • We will implement the traditional aircraft coordinate system with a reversed z axis. This results in a positive X-axis out the nose of the aircraft, positive Y-axis out the right wing, and positive Z-axis pointing upwards.
  • This specific F-16 model needs to be scaled and rotated to be oriented with the coordinate system in the lower-left corner of the screen. This model is giant and needs to be scaled to something more reasonable, around 5%. The model also needs to be rotated 90 deg in the x(roll) axis, and -90 deg in the z(yaw) axis.

Screenshot (14)

Origin Location

  • Unfortunately, Unreal Engine doesn't have an easy built in way to choose the origin of your model, however, there is a work around. We will need to import a Scene object by searching for 'Scene' in the Add tab on the left side.

Screenshot (7)

  • Next, drag your model asset into the Scene object. This will make the model a component of the Scene as shown by the now present dropdown arrow to the left of the Scene object.

Screenshot (8)

  • We can now adjust our model's origin by clicking on the model and changing the Transform Location on the left window. Adjust this origin to the CG of the aircraft. For demonstration sake for this model, a change of -550 in the X direction and -100 in the Z direction will get us in the ballpark. Make sure you are changing the location of the model and not the Scene asset.

Screenshot (15)

  • Now, when you select the Scene asset, the origin should show around the CG.

Screenshot (13)


C. Model Appearance

  • We can change the appearance of the model by using a material.
  • To create a material. Open the content browser with CTRL + Space bar.
  • Right click in the window and select ‘Material’ under ‘Create Basic Asset’, then rename.

Screenshot 2023-11-01 at 2 47 30 PM

  • Navigate to the ‘Materials’ section in our model detail window and select our new material from the drop-down menu.

Screenshot 2023-11-01 at 2 48 02 PM

  • Our model now has the appearance of our new material. To edit our material, open the material by opening the Content browser again and double clicking on the material.

  • This will open a new window for the material. Right click in the grid and search ‘Constant3Vector’ then select.

Screenshot 2023-11-01 at 2 48 34 PM

Screenshot 2023-11-01 at 2 48 55 PM

  • Right click the added node and select ‘Convert to Parameter’. Then connect the node to the skin.

Screenshot 2023-11-01 at 2 49 21 PM

Screenshot 2023-11-01 at 2 49 38 PM

  • You can change the color by double clicking the big square in the node and selecting a color and clicking OK.

Screenshot 2023-11-01 at 2 50 03 PM

  • Press CTRL + S to save the skin. Our model’s color has now been changed.

Screenshot 2023-11-01 at 2 50 29 PM

Click the Compile button in the top left corner in the blueprint if it is yellow to turn it green.


D. Setting a Camera

  • Next, we will setup your camera view for your vehicle. Open your vehicle blueprint, and navigate to the 'Viewport' tab

Screenshot (745)

  • Click on the Add button and add both a 'Spring Arm', then 'Camera'.

Screenshot (746) Screenshot (747)

  • The camera asset needs to be a component of the spring arm, drag the camera onto the spring arm to do this. The spring arm should have a dropdown arrow to its left if done correctly.

Screenshot (748)

  • Next, click on your camera asset, this should display the origin of the camera in the viewport to show where the camera is.

Screenshot (749)

  • Use the transformations in the right-hand window to orient the camera for the desired view.

Screenshot (750)

  • Save and compile your blueprint. Now when the level possesses the model when the simulation is ran (complete Model Possession section), the view will default to our camera view.

Screenshot (751)