UE4 – HLSL texture sample quick tip

Software:
Unreal Engine 4.26

When sampling textures using an HLSL custom node,
The UE4 TextureObject input name, will automatically have a sampler object generated named:

<your TextureObject name>sampler

For example, if you named your TextureObject input “tex_in”, the available sampler will be named “tex_insampler”.
So the code for sampling the texture will be:

Texture2DSample(tex_in, tex_inSampler, coords);

The following is an example of a simple u-blur custom node code, with 4 node inputs:
1. tex_in – TextureObject
2. coords – float2
3. size – float
4. sample – float

int blur_samples = int(samples * 0.5f);
float3 col = 0.0f;
float2 sample_coords = 0.0f;
for (int i = -blur_samples; i < blur_samples; i ++)
{	
	sample_coords.x = i * (size / blur_samples * 2);
	col += Texture2DSample(tex_in, tex_inSampler, coords + sample_coords ) / (blur_samples * 2);
}
return col;

The above code can typed directly in the Custom node’s Code field. or loaded from an external .usf file.

See also:
Loading HLSL shaders from the project folder

UE4 – Tiny tips for tiny scale projects

Software:
Unreal Engine 4.26

When having to develop a UE4 project that deals with a tiny world scale, like the whole level being less the 50cm size for example,
The following steps may help make the project more easily navigate-able and convenient to work on.

  1. Scale down the camera Icon:
    UE4 has by default a huge, bulky, opaque camera icon.
    For a tiny scale project, this camera icon may cover the whole level and be very inconvenient to work with.
    Select the relevant camera component and scale it down.
    In my tests, this modified camera matrix isn’t breaking the camera optics in any way,
    But if you want to have no such scale offsets in your project, you can also replace the camera icon with a suitable small one.
  2. In Editor Preferences > Viewport:
    Decrease both:
    Mouse Scroll Camera Speed and Mouse Sensitivity
    To allow finer navigation at small scale

Note:
A global scale conversion factor can be used instead of taking these measures,
And in many cases this can be a more practical solution for managing a sub 50cm world,
For example, building everything 100X size so that 1 meter will be representing 1 centimeter in your project’s world.
But take into account, that if the project demands rendering realistic physical lighting and optics, extra conversions will have to be made to account for the scale conversion factor, so is such cases it may be better to setup a real-world scale project.

UE4 – Replace the Camera component icon

Software:
Unreal Engine 4.26

Note:
This seems like an awkward workaround..
So if I missed something here, and there’s a better method to do this,
I’ll be very grateful is you share it in the comments.
Also,
The following tip is only relevant for the CineCameraActor and won’t work with a regular CameraActor as it has a different built in offset (hopefully, I’ll have time to add this to the post later..)

Replacing the camera icon:
Its fairly simple to replace the Camera component’s mesh icon,
Just select the component and replace it’s Camera Mesh Static Mesh component with a different static mesh object:

So what’s the problem?
The problem is that the default mesh used for the camera icon doesn’t have its natural pivot at the focal point of the camera, but at its bottom somewhere,
And there is a hardcoded transform offset that compensates for that and places the icon mesh in a way that has the Icon lens roughly at the actual Camera actor pivot / focal point:

* I haven’t found any exposed transform parameter that allows moving the icon itself without moving the camera.
So in-order to replace the camera mesh with an alternative icon mesh, and have it be aligned properly to the camera’s pivot / focal point (without changing engine code and building it) the built-in offset must be negatively pre-added to the new mesh model:

In this example in Blender, a new icon is modeled facing positive Y, with pre-built offset to compensate for the hardcoded offset in UE.

The Camera actor with the alternative Icon:

Note:
In this example, I’ve replaced the camera icon with a much smaller model, intentionally, to suite a tiny scale project,
You can also scale the icon without replacing the model.

UE4 – Loading shaders from within the project folder

Software:
Unreal Engine 4.25

*Also tested on Unreal Engine 5.0.1

Disclaimer:
I’m probably the 10th guy that’s documenting these steps on the web,
I didn’t come up with this solution myself, I learned it from the sources listed below.
The reason I’m documenting this (again) myself is to have a clear source I can come back to for this issue because I’m absolutely incapable of remembering subjects like this…… :-\
If you find inaccuracies in the steps I’m detailing or my explanation, I’ll be very grateful if you share a comment.

  1. https://forums.unrealengine.com/development-discussion/rendering/1562454-virtual-shader-source-path-link-custom-shaders-shadertoy-demo-download
  2. https://dinwy.github.io/study/2019/july/customShaderInUE4/
  3. https://forums.unrealengine.com/community/community-content-tools-and-tutorials/1710373-using-external-shader-files-ush-usf-and-getting-the-most-of-the-custom-node

In short:
AFAIK since version 4.21 UE doesn’t load custom node shader code from your project/Shaders folder by default anymore, but only from the shaders folder in the engine installation, which makes it less practical for developing shaders for specific projects.


Steps for setting the UE project to load shaders from the project folder in UE 4.22:

> The examples here are for a project named: “Tech_Lab”

A. The project must be a C++ project:

So either create a new project, define as such or just create a new C++ class and compile the project with it to convert it to a C++ project.
Notes:
a. You may need to right click the .uproject file icon and and Generate Visual Studio Project Files for the project to load correctly into Visual Studio and compile.
b. You can delete the unneeded C++ class you added after the new settings took place.

B. Create a folder for the shader files:

Typically, it will be called “Shaders” and will be placed in the project root folder.

C. Add the RenderCore module to the project:

This is done by adding string “RenderCore” to array of public dependency modules in the <project>.build.cs file:

PublicDependencyModuleNames.AddRange(new string[] { "RenderCore", "Core", "CoreUObject", "Engine", "InputCore" });
(see image)

Notes:
a. In UE 4.21 it should be ShaderCore.
b. This addition is needed in-order to compile a new primary project module (next step).

D. Define a custom primary module for your project:

In <project_name>.h file add a new module named F<project_name>Module, with a StartupModule function overrides.
Notes:
a. We have add an include statement for “Modules/ModuleManager”.
b. The <project_name>.h file is located in the /Source/<project_name> folder.
c. Some sources state that you also have to override the ShutdownModule function, with an empty override, it works for me without this (maybe its just a mistake..)

E. Implement the function override,
and set the custom module as the project primary module:

In <project_name>.cpp file, add the StartupModule override,
With the definition of the added shaders path:
FString ShaderDirectory = FPaths::Combine(FPaths::ProjectDir(), TEXT("Shaders"));

and mapping this new path as “/Project” for conveniently including it:
AddShaderSourceDirectoryMapping("/Project", ShaderDirectory);

Last thing to do is to replace “FDefaultGameModuleImpl” with our custom module name in the IMPLEMENT_PRIMARY_GAME_MODULE macro:
IMPLEMENT_PRIMARY_GAME_MODULE(FTech_LabModule, Tech_Lab, "Tech_Lab" );

Notes:
a. We must include “Misc/Paths”
b. Note that the addition of this folder mapping is restricted to versions 4.22 and higher via a compiler directive condition. for version 4.21, you should state “ENGINE_MINOR_VERSION >= 21:

Note for UE5:
Unreal Engine 5 supports this from the get go so this compiler directive condition should be deleted for this to work.

F. Wrapping up:

After taking these steps and compiling the project.
You should be able to include .ush and .usf files stored in <your_ue_project>/Shaders with the “Project” path mapping:
include "/Project/test.usf"

That’s it! 🙂

I hope you found this helpful,
And if you encountered errors, or inaccuracies,
I’ll be grateful if you’ll take the time to comment.


Related:

  1. UE4 – Cyber enhancement shader
  2. UE4 – Fog post process effect

Blender to Unreal Engine tips

Software:
Blender 2.9 | Unreal Engine 4.25

The following is a list of guidelines for preparation and export of 3D content from Blender to Unreal Engine 4 via the FBX file format.

Disclaimer:
This is not a formal specification.
It’s a list of tips I found to work well in my own experience.
* Some of the issues listed here may have already been solved


Blender Scene and model settings:

System units in Blender:
Define the scene units in Blender as:
Metric unit with 0.01 scale (centimeters)
And model your content correctly using centimeter units.
* Modeling in 1 meter units may seem to be imported correctly into UE4 but will cause unsolvable problems like a skeletal mesh physics asset having incorrect auto-generated shapes, a problem that in my experience can’t be fixed manually.

Transform:
Model your model in Blender facing the -Y world axis, +Z obviously being up (obviously for Blender).
* This way the model is aligned to Blender’s views so the front view displays the model’s front etc.
Make sure to apply your model’s transformations before export.

Armatures:
Make sure the Armature object isn’t named “Armature”.
naming or leaving the Blender skeleton named “Armature” will cause the UE4 importer to fail due to “multiple roots”.
* Also remember some weird related bug with animation scale incorrectly imported, but can’t confirm this now..
No need for a dedicated root bone in the hierarchy. the Armature object is the root of the bone hierarchy.
* See export option below

Texture baking:
Set the normal map’s green channel to -Y.
* This is not critical at all because if baked as +Y it can easily be fixed in UE4.

Metadata:
Blender custom properties import as UE4 asset metadata that can be read by editor scripts for automation purposes.
* See export option below


FBX Blender export and UE4 import settings:

I recommend saving an FBX export preset with these settings.

Optional:
I prefer the export settings to include only selected objects.
* It’s more efficient for me to select the specifics objects I want to export into a single FBX file prior to export, than to delete all the temp / reference / draft objects from the scene.
If you want to export Blender custom properties with to the FBX check the “Custom Properties” option

Axes:
Blender’s native model/world orientation is model’s forward facing the -Y axis, left side facing +X and of-course up facing +Z.
UE4’s native model/world orientation is model’s forward facing the +X axis, left side facing -Y and up facing +Z.
There are axis settings in Blender’s FBX export module, that theoretically, should be set like this:

However, in tests I did, The axis settings made no difference when importing to UE4, even when setting intentionally incorrect upside-down axes.
Maybe the FBX exporter writes these settings to metadata that the UE4 importer doesn’t read..
From my experience, what’s important is to orient the model correctly in Blender (see above), apply the transformations,
And in the UE4 import menu, check the “Force Front XAxis” option:

Geometry:
Make sure either “Edge” or “Face” is chosen in the “Smoothing” option to import the mesh’s smooth shading correctly ans avoid a smoothing groups warning on import:

Optional:
Depending on how much control you need over the mesh’s tangent space,
You may want to check the “Tangent Space” export option,
This will make Blender export the full tangent space to the FBX and make UE4 read it from FBX instead of generate it automatically.
* For this option to be supported, the mesh geometry must have only triangle or quad polys.
In the UE4 import settings, choose the “Import Normals and Tangents” option in “Normal Import Method”:

Armature:
Set “Armature FBXNode Type” to “Root”.
Uncheck the “Add Leaf Bones” option to avoid adding unneeded end bones.
Set bones primary axis as X, and secondary axis as -Z.

Animation:
Uncheck “All Actions” to avoid exporting actions that don’t actually belong to the skeleton.
* Un-related animations in the FBX can also corrupt the character rest pose in UE.
The “NLA Strips” option is useful for exporting a library of animations with the skeleton.
* In Blender’s NLA editor, activate the actions you want exported to the FBX.


Related:
3ds max & V-Ray to UE4 Datasmith workflow

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 – 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 – 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! 🙂