UE4 – Technical model visualization tips

Software:
Unreal Engine 4.25

This post is a summary of the tips given by Epic Games technical-artist Min Oh in his GDC 2017 lecture about improving photo-realism in product visualization, more specifically, how to render high quality surfaces.
I recommend watching the full lecture:

  1. Render sharper reflections by increasing the Cubemap resolution of reflection captures:
    Project Settings > Engine > Rendering > Reflection > Reflection Capture Resolution
    * use powers of 2 values i.e. 256, 512, 1024….
    Annotation 2020-07-06 195120
  2. Improve the accuracy of environment lighting by increasing the Cubemap resolution of the Skylight:
    * use powers of 2 values i.e. 256, 512, 1024….
    Annotation 2020-07-06 202415
  3. Improve screen space effects accuracy like screen space reflections by setting the engine to compute high precision normals for the GBuffer:
    Set Project Settings > Engine > Rendering > Optimizations > GBuffer Format to:
    High Precision Normals
    Annotation 2020-07-06 204022
  4. Use a high degree of tessellation (subdivision) for the models pre-import.
    Simpy put:
    Use high quality models.
  5. Improve the surfaces tangent space accuracy, and as a result also the shading/reflection accuracy by setting the model’s static mesh components to encode high precision tangent basis:
    Static Mesh Editor > Details > LOD 0 > Build Settings > Use High Precision Tangent basis
    Annotation 2020-07-06 210030
  6. Creating materials with rich dual specular layers by enabling material clear coat separate normal input:
    Project Settings > Engine > Rendering > Materials > Clear Coat Enable Second Normal
    Annotation 2020-07-06 211152Set the material Shading Model to Clear Coat and use a ClearCoatBottomNormal input node to add a normal map for the underlying layer:
    Annotation 2020-07-06 221027

 

Related:

  1. UE4 – Lighting calculation tips
  2. UE4 HDRI lighting
  3. UE4 – Enable DXR ray-traced reflections 

UE4 – Enable DXR Raytracing

Software:
Unreal Engine 4.25

Steps for activating DXR Ray-tracing in a UE4 project:

  1. Project Settings:
    Platforms > Windows > Targeted RHIs:
    Set Default RHI to DirectX 12
    * RHI = Rendering Hardware Interface
  2. Project Settings:
    Engine > Rendering > Ray Tracing:
    Check Ray Tracing
    * Requires restarting the editor, and may take a while to load the project afterwards..
    * I’m actually not sure if the reason for delay in re-launching the project is a full re-build of the lighting or compiling shaders..
  3. Post Process Volume > Rendering Features > Reflections:
    Set Type to: Ray Tracing
  4. Post Process Volume > Rendering Features > Ray Tracing Reflections:
    Set Max Bounces to more than 1 if needed

No DXR Reflections:
Annotation 2020-07-05 011317

DXR Reflections on a GTX 1070 GPU:
Annotation 2020-07-05 020433

 

Related posts:

  1. UE4 Light calculation tips
  2. UE4 HDRI lighting
  3. UE4 – Technical model quality tips

UE4 – Lighting calculation tips for Archviz

Software:
Unreal Engine 4.25

The Static Lighting calculation in UE4 is performed by the Lightmass module (UE4’s integrated GI* engine), and the result of this calculation is stored in each object’s Lightmap, an extra texture map used for storing static light and shadow information.
This post provides a list of useful tips and techniques for improving your UE4 scene setup for an efficient light calculation.

Annotation 2020-07-04 223338

Notes:

  1. The following tips are aimed at achieving a good lighting calculation/solution but they don’t include optimization methods for high performance projects.
    Namely, we don’t get into manual Lightmap UV optimizations here.
  2. The following tips don’t take into account the now real-time ray-tracing options that have become available with Nvidia Geforce RTX / DirectX DXR.

 

Scene Setup:

  1. Delete unseen polygons from your mesh, so they wont waste Lightmap resolution.
    * For example, in an interior Archviz project, delete the outer polygons of the walls.
  2. Set the architectural surfaces to cast shadows from both sides:
    Details > Lighting > Shadow Two Sided
    Annotation 2020-07-04 231158
  3. Place “light blockers” around the structure to avoid light licks.
    * Wrap the structure on all sides with scaled cubes that have an absolute black material:
    Annotation 2020-07-04 194647
  4. Set the “light blockers” to be invisible in rendering:
    Annotation 2020-07-04 194713
  5. Scale the Lightmass Importance Volume fit around the structure tightly.
    Annotation 2020-07-04 185623

 

Lightmap Resolution:

  1. Optimize the architectural surfaces (static meshes) Light map resolution.
    A higher resolution will allow the Light Map to store more detailed lighting.
    The Static Mesh resolution setting is found in:
    Static Mesh Edior > Details > General Settings > Light Map Resolution:
    * This setting can also be overriden at the actor settings by selecting the actor in the map/level and activating:
    Details > Lighting > Override Lightmap Res
    Annotation 2020-07-04 214810
  2. Use the Lightmap Density optimization display mode to inspect the actual Lightmap texel density.
    The Lightmap Density display mode also color codes the display to indicate the efficiency of the Lightmap resolution per object (green color being optimal, and warm colors being too dense)
    * Note that in many cases of Archviz you may want a higher density than the editor displays as optimal.
    Annotation 2020-07-04 195909

 

Lighmass Settings:
The Lightmass setting are found in:
World Settings > Lightmass

  1. Decrease the Volumetric Lightmap Detail Cell Size to increase the light calculation accuracy:
    * This will increase the calculation time
    Annotation 2020-07-04 214102
  2. Decrease the Indirect Lighting smoothness to get more detailed shadows:
    Annotation 2020-07-04 232028
  3. Disable Compress Lightmaps to avoid banding artifacts in the shadow gradient:
    Annotation 2020-07-04 214102b
  4. Use the Lighting Only display mode to evaluate the lighting solution:
    Annotation 2020-07-04 200645
  5. For final quality, set the Light Quality to Production:
    Build menu > Lighting Quality > Production
    Annotation 2020-07-04 222201

 

* GI – “Global Illumination” is a term referring to indirect light simulation, namely a calculation of how light reflects and bounces between surfaces.

 

Related posts:

  1. 3ds max & V-Ray to UE4 using Datasmith
  2. “Cleaning” the UE4 FPS template for Archviz
  3. UE4 – HDRI Lighting
  4. UE4 – Activate DXR ray-traced reflections

UE4 – “Cleaning up” the FPS template for an Archviz project

Software:
Unreal Engine 4.25

Annotation 2020-06-18 194857

The UE4 First Person template is a good way to start an Architectural virtual tour project, but we first need to “clean” it up, namely, get rid of all the unnecessary objects and settings.

Start with the obvious:
Delete all the cubes and blocks. (Simply select them and press delete)
The quickest way to select all these objects is through the World Outliner window.
Select all the unneeded objects (see image below) and delete them.
Note:
I’m intentionally keeping the 4 surrounding wall objects because I want them to serve as invisible barrier objects that will stop the player from wondering of the platform.Annotation 2020-06-18 195553

So now our level looks like this, with weird static shadows left by the “BigWall” objects that were deleted.
It’s not really critical to fix this at this stage, but if you want to get rid of the weird left-over shadows, simply press the Build button to re-build the lighting, and they will be gone.Annotation 2020-06-18 200303

Making the walls invisible:
Select the 4 wall objects, and in the Details window, in the Lighting Settings uncheck Cast Shadow,
And under Rendering uncheck Visible.
The level is now clear, and when we press play, we can free roam on the empty stage until we hit the invisible walls.
* You can re-build the lighting to get rid of the walls static shadow.
Annotation 2020-06-18 203043

Time to get dirty!
We now have to get rid if the FPS rifle and shooting setup….
Select the FirstPersonCharacter actor, and in the World Outliner window click Edit FirstPersonCharacter to open the actors Blueprint:
Annotation 2020-06-18 210611
In the FirstPersonCharacter Blueprint, navigate to the Viewport tab so you’l be able to see the mesh components clearly,
And in the actor Components Window on the left, select all the unneeded components, delete them and press the Compile button.
* make sure you don’t select the FirstPersonCamera or any of the inherited componentsAnnotation 2020-06-18 211326
A list of reported errors will now be displayed in the Compile Results window, because we deleted objects that are referenced by the Blueprint, we will fix this in the next step:Annotation 2020-06-18 211509
Navigate to the Construction Script tab, Select the AttachComponentToComponent node (currently displaying an error) and delete it.Annotation 2020-06-18 213100
Navigate to the Event Graph tab, locate the first Event Graph at the top of the Blueprint, this is the Event BeginPlay graph.
Select the 2 Set Hidden in Game nodes (currently displaying an errors) and delete them:Annotation 2020-06-18 213152
Locate the Spawn projectile node graph at the bottom of the Event Graph,
Select this whole section, delete it and press Compile.
Annotation 2020-06-18 213243
The Event Graph should now look like this, and compilation should be without errors because we deleted all the Blueprint parts that were referencing the deleted actor components:Annotation 2020-06-18 213349

Almost there..
It’s time to remove the small red targeting cross-hair icon displayed on the screen when playing.
The cross-hair icon is defined in the level’s HUD (Heads Up Display) Blueprint class.
The easiest way to remove it is to simply remove the HUD class from the level.

Note:
The FirstPersonHUD class can be useful to an Archviz project for displaying branding and architectural data on screen so it’s good to keep it in the project. it can later be modified to suit our needs used again (doing that is beyond the scope of this article).
If you wish to edit the HUD Blueprint instead of disconnecting it from the level, you’ll find it in Content > FirstPersonBP > Blueprints > FirstPersonHUD:
Annotation 2020-06-18 220637

To remove the HUD from the level, navigate to the World Settings window,
If it isn’t displayed open it from Settings > World Settings:
Annotation 2020-06-18 220538
In the World Settings window, under Game Mode > Selected GameMode, open the HUD Class drop-down and instead of FirstPersonHUD, choose None.
This will remove the HUD from the level but wont delete it from the project:
Annotation 2020-06-18 220513

Were done!

You can now decide whether to keep the default daylight setup or maybe delete its actors and create an HDRI lighting instead,
And you can now import your Archviz scene via the Datasmith plugin.

Hope you found this article useful! 🙂

Related posts:

  1. 3ds max & V-Ray to UE4 Data Smith workflow
  2. UE4 HDRI lighting
  3. UE4 – Connecting the directional light to the atmosphere
  4. UE4 Architectural glazing material
  5. UE4 – Archviz Light calculaion tips

 

UE4 – HDRI Environment & Lighting

Software:
Unreal Engine 4.25

Annotation 2020-05-20 162811

Creating HDRI environment backgruond and lighting* in UE4:
Note:
Lighting using a panoramic HDRI background is also referred to as IBL – Image Based Lighting.

* The example HDRIs in this post are from www.hdrihaven.com

  1. Import HDRI environment file.
    Note:
    The file must be saved as a *.hdr file and not *.exr because AFAIK that’s the only way UE4 will recognize it as an HDRI environment and encode it as a Texture Cube (cube map)
  2. Enable the HDRIBackdrop plugin:
    Go to Edit > Plugins
    Type “HDRI” in the search field to locate HDRIBackdrop and enable it.
    * You’l have to restart the UE Editor before using the plugin
    Annotation 2020-05-20 153925
  3. Drag a Lights > HDRI Backdrop object to your level:
    Annotation 2020-05-20 154657
  4. In the HDRIBackdrop details, select the wanted Cubemap:
    Annotation 2020-05-20 155212
  5. > Set the HDRIBackdrop‘s Intensity (self explanatory..).
    > Rotate the HDRIBackdrop around its Z axis to set the environment’s direction.
    > Set the HDRIBackdrop‘s Size.
    * Make it larger than your whole scene,
    And if Use Camera Projection is unchecked make it also large enough so that noticeable objects in the HDRI image will be distant enough as to not move incorrectly when you strife.
    * When Use Camera Projection is activated the Size property has no effect.
    > If Use Camera Projection is unchecked, set the Projection Center Z value to define the background image height below which it is projected as a flat ground.
    > Lighting Distance Factor defines ground projection area that will appear to receive shadows from your scene objects.
    * Set this attribute to 0 in-order to turn off the ground projection shadow.
    > Use Camera Projection:
    Activate this option to get a traditional infinitely far background with no flat ground surface projection.Annotation 2020-05-20 160338

 

Related:

  1. Sun & Sky link
  2. UE4 Architectural Glazing
  3. 3ds max & V-Ray to UE4 Datasmith workflow
  4. Preparing an FPS project for archviz
  5. UE4 – Archviz Light calculaion tips

3ds max & V-Ray to UE4 – Datasmith workflow basics and tips

Software:
3ds max 2020 | V-Ray Next | Unreal Engine 4.25

This post details basic steps and tips for exporting models from 3ds max & V-Ray to Unreal Engine using the Datasmith plugin.
The Datasmith plugin from Epic Games is revolutionary in the relatively painless workflow it enables for exporting 3ds max & V-Ray architectural scenes into Unreal Engine.
Bear in mind however, that Datasmith‘s streamlined workflow can’t always free us from the need to meticulously prepare models as game assets by the book (UV unwrapping, texture baking, mesh and material unifying etc.) (especially if we need very high game performance).
That being said, the Datasmith plugin has definitely revolutionized the process of importing assets into Unreal, making it mush more convenient and accessible.

 

Preparation:
Download and Install the Datasmith exporter plugin compatible with your modeling software and Unreal Engine version:
https://www.unrealengine.com/en-US/datasmith/plugins

 

In 3ds max & V-Ray:

  1. Make sure all materials are VRayMtl type (these get interpreted relatively accurately by Datasmith)
  2. Make sure all material textures are properly located so the Datasmith exporter ill be able to export them properly.
  3. In Rendering > Exposure Control:
    Make sure Exposure control is disabled.
    Explanation:
    If the Exposure Control will be active it will be exported to the Datasmith file, and when imported to Your Unreal Level/Map a “Global_Exposure” actor will be created with the same exposure settings.
    Sounds good, right? So what’s the problem?
    The problem with this is that these exposure setting will usually be compatible with photo-metric light sources like a VRaySun for example, but when imported to Unreal, the VRaySun does not keep its photo-metric intensity. (in my tests it got 10lx intensity on import). the result is that the imported exposure settings cause the level to be displayed completely dark.
    Of-course you can simply delete the “Global_Exposure” actor after import, but honestly, I always forget its there, and start looking for a reason why would everything be black for no apparent reason…
    * If your familiar with photo-metric units, you can set the VRaySun to its correct intensity of about 100000lx, and also adjust other light sources intensity to be compatible with the exposure setting.
  4. Annotation 2020-05-12 192439
  5. Select all of the models objects intended for export,
    And File > Export > Export Selected:
    * If you choose File > Export > Export you’l still have an option to export only selected objects..
    Annotation 2020-05-12 192506
  6. In the File Export window,
    Select the export location, name the exported file,
    And in the File type drop-down select Unreal Datasmith:
    Annotation 2020-05-12 192550
  7. In the Datasmith Export Options dialog,
    Set export options, and click OK.
    * Here you select whether to export only selected object or all objects (again)
    Annotation 2020-05-12 192654
  8. Depending on the way you prepared your model,
    You may get warning messages after the export has finished:
    Explanation:
    Traditionally, models intended for use in a game engine should be very carefully prepared with completely unwrapped texture UV coordinates and no overlapping or redundant geometry UV space.
    Data-smith allows for a significantly forgiving and streamlined (and friendly) workflow but still warns for problem it locates.
    In many cases these warnings will not have an actual effect (especially if Lightmap UV’s are generated by Unreal on import), but take into account that if you do encounter material/lighting issues down the road, these warnings may be related.
    Annotation 2020-05-12 192730
  9. Note that the Datasmith exporter created both a Datasmith (*.udatasmith) file, and a corresponding folder containing assets.
    It’s important to keep both these items in their relative locations:
    Annotation 2020-05-12 204541

 

In Unreal Editor:

  1. Go to Edit > Plugins to open the Plugins Manager:
    Annotation 2020-05-12 192802
  2. In the Plugins Manager search field, type “Datasmith” to find the Datasmith Importer plugin in the list, and make sure Enabled checked for it.
    * Depending on the project template you started with, it may already be enabled.
    * If the plugin wasn’t enabled, the Unreal Editor will prompt you to restart it.
    Annotation 2020-05-12 192901
  3. In the Unreal project Content, create a folder to which the now assets will be imported:
    * You can also do this later in the import stage
    Annotation 2020-05-12 193030
  4. In the main toolbar, Click the Datasmith button to import your model:
    Annotation 2020-05-12 193043
  5. Locate the the *.udatasmith file you exported earlier, double click it or select it and press Open:
    Annotation 2020-05-12 193129
  6. In the Choose Location… dialog that opens,
    Select the folder to which you want to import the assets:
    * If you didn’t create a folder prior to this stage you can right click and create one now.
    Annotation 2020-05-12 193301
  7. The Datasmith Import Options dialog lets you set import options:
    * This can be a good time to raise the Lightmap resolution for the models if needed.
    Annotation 2020-05-12 193326
  8. Wait for the new imported shaders (materials) to compile..
    Annotation 2020-05-12 193408
  9. The new assets will automatically be placed into the active Map\Level in the Editor.
    All of the imported actors will be automatically parented to an empty actor names the same as the imported Datasmith file.
    In the Outliner window, locate the imported parent actor, and transform it in-order to transform all of the imported assets together:
    * If your map’s display turns completely dark or otherwise weird on import, locate the “Global_Exposure” actor that was imported and delete (you can of-course set new exposure setting or adjust the light settings to be compatible)
    Annotation 2020-05-12 193517

 

 

Related:

  1. Preparing an FPS project for archviz
  2. Unreal – Architectural glass material
  3. Unreal – Camera animation
  4. UE4 – Archviz Light calculaion tips

UE4 – Creating two sided material effects using the TwoSidedSign node

Software:
Unreal Engine 4.24

The TeoSidedSign node let’s the shader “know” if a rendered polygon is facing the camera or not by outputting a value of 1 for facing polys and -1 for back-facing polys.
This is useful for creating materials that have different properties when seen front-facing or back-facing.

Example 1:
Blending two different colors based on face direction:

  1. Check the Two Sided material attribute.
    * Needed so that the engine will render the polygons beck sides.
  2. In the material blueprint, create a blend of to colors using a Lerp (LinearInterpolate) node and connect it to the material’s Base Color input.
  3. Add a TwoSidedSign node to get polygon facing input (1,-1).
  4. Connect the TwoSidedSign node’s output to a Clamp node to clamp the values to (1,0).
  5. Connect the  Clamp node’s output to the Lerp node’s Alpha input so that the polygon’s facing direction will control the Lerp blend.

Note:
You can use this method to blend any other material attribute based on polygon facing direction.

Annotation 2020-05-11 133226

 

Example 2:
Create an “inwards facing” flipped normal material:

  1. Set the material’s Blend Mode to Masked.
    * Needed for being able to make areas parts of the mesh invisible.
  2. Check the Two Sided material attribute.
    * Needed so that the engine will render the polygons beck sides.
  3. Add a TwoSidedSign node to get polygon facing input (1,-1).
  4. Connect the TwoSidedSign node’s output to a Clamp node to clamp the values to (1,0).
  5. Connect the Clamp node’s output to a 1-X node to invert the facing input.
  6. Connect the 1-X node’s output to the material’s Opacity Mask input so that polygons facing the camera will be invisible.

Annotation 2020-05-11 130703

 

Related:

  1. Blending material using Paint
  2. Material Functions
  3. UE4 Bump Map

UE4 – Using a Post Process material to create a simple fog effect

Software:
Unreal Engine 4.24

An example of a simple fog effect created using a Post Process material:

 

The fog material Blueprint:
The method for creating the fog effect is to take distance of the objects from the camera, map it to a value range suitable for color blending 0 – 1, and use that for blending the object’s color with the fog color, so the further away the object, the more it will be colored by the fog.
Start by creating a new material, and follow the details below to create the Blueprint:

Fog_PP_material

  1. The Material Domain is set to Post Process.
    And has its Blendable Location parameter set to Before Tonemapping so it will be applied on the raw render.
    Annotation 2020-05-04 011312
  2. A SceneTexture node with its Scene Texture Id parameter set to PostProcessInput0 serves as the input of the view’s original rendered pixel colors:
    Annotation 2020-05-04 011050
  3. A Lerp (LinearInterpolate) node calculates the blending of the view’s original pixel colors with the Fog color to create the fog effect.
  4. A SceneTexture node with its Scene Texture Id parameter set to SceneDepth serves as the input of depth of each pixel (distance from camera):
    Annotation 2020-05-04 012256
  5. A ComponentMask node set to the R channel allows using the depth data as a single float value instead of a Vector4:
    Annotation 2020-05-04 012603
  6. A Clamp node is used to clamp (limit) the depth value to the Fog’s maximum depth value (see below)
  7. A RemapValueRange maps the distance value to a fog density value that will be used as the Lerp (3) alpha parameter.
    Simply put, the further the object, the more the original color will be blended with the fog color.
  8. A Power node (raises the fog blend factor by an exponent) make the fog blending non-linear, that is beginning gently for closer objects and than increasing more drastically as the distance grows (provided that the exponent value is above 1)
  9. A Constant Vector4 serves as an input for the fog color.
    * Note that having this input be a Vector4 and not a Vector3 allows it to be interpolated with the PostProcessInput0 data, otherwise a ComponentMask (RGB) node would have been necessary to convert the PostProcessInput0 to a Vector3.
  10. a float constant serves as an input for the fog’s minimal distance (from camera)
  11. a float constant serves as an input for the fog’s maximal distance (from camera)
    *  Note that it’s connected both to the Clamp node and to the RemapValueRange node.
  12. a float constant serves as an input for the fog’s minimal opacity (blend amount)
  13. a float constant serves as an input for the fog’s maximal opacity (blend amount)
  14. a float constant serves as an input for the fog’s blend exponent.

 

Applying the Post Process material to the level:

Fog_2

  1. Select the PostProcessVolume actor in the World Outliner window.
    * Create a PostProcessVolume actor if necessary.
  2. In the Details panel, under Rendering Features > Post Process materials,
    Add a new item to the array, in the new item’s value choose Asset Reference,
    And then select your fog material:
    Annotation 2020-05-04 015354
    Annotation 2020-05-04 015831

 

Related:

  1. Material Functions
  2. Blending materials
  3. Blending materials using texture paint

UE4 – Change the size of the UI and fonts

Software:
Unreal Engine 4.24

To Change the size of the UI and fonts in the Unreal Editor:

  1. Select:
    Window > Developer Tools > Widget Reflector
    To open the Widget Reflector window
    Annotation 2020-04-23 150847
  2. In the Widget Reflector window, change the Application Scale parameter:
    Annotation 2020-04-23 151022

Unreal Engine 4 + GitHub First Steps

Software:
Unreal Engine 4.24 | Git for Windows | Git LFS | GitHub Desktop

What is this all about?
A game development project is in fact a software development project, and therefore requires Source Control (aka “Version Control”).
A Source Control solution is a software system that registers and stores states of the code as it develops, and allows the developers to manage the changes, compare different versions of the project, revert to previous versions and much more.
There are more than one popular Source Control solutions in the market.
This article is written specifically about setting-up Source Control for an Unreal Engine 4 project using Git Source Control software, focusing on working with the GitHub desktop client app for Windows.

Disclaimer:
Although I’ve already had some experience using Git Source Control,
This is the first time I’ve had to set it up for myself by myself from scratch specifically for UE4 (using Git LFS), So this article can’t be regarded as an authoritative guide to the subject.
This is simply an informative record of the steps taken, problems encountered, notes, etc.
Hopefully, this post will be helpful, and if you find mistakes, inaccuracies, or that I forgot some steps, I’ll be grateful if you’ll post a comment.

General Preparations:

  1. Create a GitHub account:
    github.com
    Note:
    The installations of the Git client tools in the next steps will require your GitHub login credentials (I don’t remember exactly which and when, because I didn’t document every step being busy getting things to work…)
  2. Install Git for Windows:
    gitforwindows.org
    Note:
    With the installation of Git for windows we not only get the Git Client software, responsible for performing all the Source Control operations, but also Git Bash which is (in my opinion) a very convenient command-line console specialized for Git operations.
  3. Install Git LFS:
    git-lfs.github.com
    Note:
    The Git LFS client is responsible for compressing and uploading the large binary files, which is to simply say, the files that are not ascii text format like software source code files / scripts / meta-data / settings etc., but typically media files like 3D models, graphic files, audio and the like.
    We generally don’t have to do anything directly with the Git LFS client, The Git Client automatically runs it, and it operates according settings written in text files placed at the Git repository root folder (more detail on this below).
  4. Optional: Install GitHub Desktop:
    desktop.github.com
    Note:
    This is an optional desktop Git client with a GUI for performing git operations.
    You can do everything without it, but its convenient, and was specifically helpful for me with setting up a UE4 repository, because it provides preset Git LFS settings (more on that below).

Steps for setting up a UE4 project GitHub repository:

Note:
I’m using GitHub Desktop to initialize the repository with UE4 Git LFS settings and also
  1. Create an Unreal Engine 4 project (if you haven’t already created one..)
    Note:
    If you want the 3D assets, texture files, etc. to be tracked and version controlled as an integral part of the UE4 project, add a “Raw_Content” or “Raw_Assets” folder inside the UE4 project folder to store them in their editable formats prior to being imported to the Unreal project.
    Uploading such large binary files to git requires using Git LFS as described below.
  2. Important: Backup a full copy of the UE4 project somewhere safe at least for the first steps.
    Note:
    I Actually needed to use this backup to save my own project (see below)
  3. In GitHub Desktop, choose File > New repository to open the Create a new repository dialog.Annotation 2020-04-18 212957
  4. A. In the Name field Type the exact name of the UE4 project (The name of it’s root folder).
    B. Write a short description of your project in the Description field.
    C. Set the Local path to the folder containing the your project folder, not the project folder itself.
    D. In the Git ignore drop-down select the UnrealEngine Option.
    E. Press the Create repository button.Annotation 2020-04-18 213139
    Note:
    Stage D is very important, it creates an initial .gitignore file with specific settings for a UE4 project, namely what files and folders to track and upload. a UE4 project generates massive files that are needed to run the game but are redundant, because they can always be generated again. these files shouldn’t be tracked or uploaded, and without proper settings in the .gitignore file, you wont be able to push (upload) the repository to the remote server.
    This is one of GitHub Desktop’s advantages, that it offers these Git Ignore presets.
    Another Note:
    We could “Publish” the repository to to GitHub server at this stage (see explanation below).
    But the reason I don’t recommend performing this action at this stage is that for a UE4 project to be successfully uploaded (“pushed”) to the remote server, we must have proper Git LFS settings, which we haven’t finished to set up prior to that.
    Blender Note:
    If you work with Blender and it’s setup to save the *.blend1 backup files, it’s recommended to add this type of file to the Git Ignore file like this:Annotation 2020-05-29 140520

Setting up Git LFS for the new repository:

Note:
Git LFS (Large File Storage) is necessary for tracking and uploading large binary files like 3D models, texture files, audio, etc.
Depending on the size of your project, you may need to upgrade the LFS storage capacity of your GitHub account.

  1. Open Git Bash for the new repository by right clicking its root folder background and choosing Git Bash Here:Annotation 2020-04-19 002454
  2. In the Git Bash console, write the command:
    git lfs installA
    This command sets-up Git LFS for the repository:B
  3. For every type of binary file that you want to be tracked and uploaded by Git LFS,
    Type the command:
    git lfs track *.<file type extension>
    To add this file type to the list of files tracked by Git LFS:
    * This list is stored in the text file named “.gitattributes” that was automatically created in the project folder when the repository was initiated.C
    Note:
    You can at any time type the command:
    git lfs track
    to display a list of the file types being tracked.
    You can open the .gitattributes file and see the list.
    This is an example of the LFS track list for one of my UE4 projects:E

Publishing the new repository to the GitHub server:

Note:
This step includes initiating the remote repository on the GitHub server, setting it as the local repository’s origin, verifying it and pushing (uploading) the current state of the local repository to the remote one.
GitHub desktop let’s us perform all these actions at ones with it’s Publish repository button.
If you wish to know how to perform these operations without using GitHub desktop, this article gives detailed explanations.

Steps for publishing the new repository with GitHub desktop:

  1. Commit the recent changes (Git LFS settings we just set):
    In Github desktop (assuming the repository we just initiated is selected in the Current repository drop-down), in the Changes pane, observe the list of latest changes to the repository. it should include the changed .gitattributes file, and maybe more changes.
    In the Description field, type a short description of the changes like “Updated Git LFS settings” for example, and press the Commit to master button to commit the updated state of the repository to the source control history.Annotation 2020-04-19 012328
  2. Publish the repository:
    The next actions will both initiate a remote repository on the GitHub server, set it up as the origin of the local repository, and push (upload) the the local repository to the server.
    In GitHub desktop, make sure the new repository is selected in the Current repository drop-down and press the Publish repository button to open the Publish repository dialog.Annotation 2020-04-19 012509
  3. In the Publish repository dialog, name the remote repository (AFAIK it doesn’t have to be the exact name as your local repository’s root folder’s name, but it’s convenient if it is..), Type a description for the project, check weather it should be public or private and press the Publish repository button.
    The repository’s remote origin will now be initiated, and the local repository’s state and commit history will be pushed (uploaded) to the server to update the origin.
    * Depending on the size of your local repository, this may take some time…Annotation 2020-04-19 012541
  4. Once the process of publishing the new repository has finished, we can browse the new remote repository on GitHub:Annotation 2020-04-19 013620

Regularly committing and pushing updated state of the project/repository:

Note:
You might want to commit an updated state of your project to source control at the end of a day’s work to back it up, or when some specific development goal has been reached, or prior to some significant change, or maybe in-order for other team members/users to be able to get the latest version of the project. there could be many reasons for committing the current state of the project to Git, but the most important reason is that you want to be able to restore the current state of the project In the future.
Steps for committing the updated state of the repository to Git and pushing it to the remote server:
  1. Commit the changes to Git:
  2. In Github desktop select the repository of your project in the Current repository drop-down, observe the list of latest changes to the repository in the Changes pane, where you can highlight a changed file and see on the right the actual change in code it represents. un-check changes you don’t want to commit.
    In the Description field, type a short description of update, and press the Commit to master button to commit the updated state of the repository to the source control history.Annotation 2020-04-20 232346
  3. After the latest changes have been committed, you’l see the new committed state appear in the History pane, with an upwards arrow icon indicating it hasn’t been pushed to the server yet.
    Highlight the top committed state and press the Push origin button to update the remote repository on the GitHub server.
    Note:
    When the repository wasn’t yet initiated on the remote server,
    The same button that now has the title Push origin had the title Publish repository.Annotation 2020-04-20 232419
  4. While committing changes to source control for version management and backup is the basic usage of Git, there are many more source control operations that can be performed, like reverting to past commits (states) of the repository, opening new branches for to manage different version of the project, merging branches etc. to name just a few examples. these operations are beyond the scope of this article, and I strongly recommend to get to know them and more.

Unreal Editor Git Plugin:

Annotation 2020-04-21 222458
There is a free, open source Git client plugin for the Unreal Editor developed by Sébastien Rombauts, that ships (at beta stage) included with UE4 4.24, and has many useful features integrated into the Unreal Editor like initiating the project repository with Git LFS setting, committing project states directly from the within the Editor, comparing versions of blueprints and more.
I did some tests with the plugin and found it very convenient, however It doesn’t track changes to the projects C++ code so if your coding you’ll have to commit code changes using a different Git client.
It may be that I just didn’t understand how use the plugin or set it up to track C++ code. I didn’t to find out if it officially doesn’t support this. however, if you work heavily with Blueprints It should be very useful.

Some issues I encountered:

Note:
I don’t know if these issues happen frequently, the reason may very well be me not doing things correctly.
There may be simple solutions to these issues that I don’t know about..
What’s absolutely certain is:
When you’s about to start your first steps with source control on a real project, make sure you back it up first!
Corrupted .uproject file:
After the first time I managed to get all the LFS setting right and successfuly push publish the project, strangely, it wouldn’t launch in the UE Editor, displaying the following message when I tried to double click the project .uproject file:
Untitled-1
And displaying the following message when I tried to launch it through the Epic launcher:
Untitled-2
After some inquiry I found out (to my astonishment) that some how the git operations have replaced the text contents of the .uproject file from this:
Untitled-3
To this:
Untitled-3
Luckily for me I had a full backup of the whole project before starting the setup trial and error process, so I could manually restore the .uproject file to it’s correct state and go on working.
Corruption during download from GitHub:
After a couple of successful commit and push operations with my project, I decided to test how a git repository works as backup, so I tried to download the project folder compressed to a zip file.
The extracted project would launch and compile, but fail to load the main (and only) level it had, displaying this message:
clone
Looking into this, I found that the level umap file is was actually in it’s place but drastically reduced in size:
* The left is the original
clone2
The good news:
I then tried to clone the project via git clone command, and that way it did work as expected.
That’s it!
I hope you’ll find this article useful or even time/error saving.
If you find anything unclear, inaccurate or missing, I’ll be grateful if you leave a comment.
Happy Unrealing and Source Controlling! 🙂