Steps for activating DXR Ray-tracing in a UE4 project:
Project Settings: Platforms > Windows > Targeted RHIs:
Set Default RHI to DirectX 12 * RHI = Rendering Hardware Interface
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..
Post Process Volume > Rendering Features > Reflections:
Set Type to: Ray Tracing
Post Process Volume > Rendering Features > Ray Tracing Reflections:
Set Max Bounces to more than 1 if needed
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)
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
Drag a Lights > HDRI Backdrop object to your level:
In the HDRIBackdrop details, select the wanted Cubemap:
> 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.
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.
Make sure all materials are VRayMtl type (these get interpreted relatively accurately by Datasmith)
Make sure all material textures are properly located so the Datasmith exporter ill be able to export them properly.
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.
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..
In the File Export window,
Select the export location, name the exported file,
And in the File type drop-down select Unreal Datasmith:
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)
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.
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:
In Unreal Editor:
Go to Edit > Plugins to open the Plugins Manager:
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.
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
In the main toolbar, Click the Datasmith button to import your model:
Locate the the *.udatasmith file you exported earlier, double click it or select it and press Open:
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.
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.
Wait for the new imported shaders (materials) to compile..
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)
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 version 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 GitHubdesktop client app for Windows.
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.
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…)
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.
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).
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:
I’m using GitHub Desktop to initialize the repository with UE4 Git LFS settings and also
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.
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)
In GitHub Desktop, choose File > New repository to open the Create a new repository dialog.
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. 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:
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.
Open Git Bash for the new repository by right clicking its root folder background and choosing Git Bash Here:
In the Git Bash console, write the command: git lfs install
This command sets-up Git LFS for the repository:
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. 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:
Publishing the new repository to the GitHub server:
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:
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.
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.
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…
Once the process of publishing the new repository has finished, we can browse the new remote repository on GitHub:
Regularly committing and pushing updated state of the project/repository:
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:
Commit the changes to Git:
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.
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.
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:
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:
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:
And displaying the following message when I tried to launch it through the Epic launcher:
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:
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:
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
The good news:
I then tried to clone the project via git clone command, and that way it did work as expected.
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.
When It comes to OOP inheritance, the best practice is to take a moment to think about code structure and decide which classes should be be extensions of a common super-class. But in a wild hackathon or game-jam, we may be blueprinting too hastily for that, and we may find out different blueprint classes actually have to be child classes of a common parent class after they already exist and have existing blueprints in them.
In this case will have to Set their parent class as a different class than the class we chose when we initially created them, and also create calls to the parent class event functions if needed.
Setting a BP’s parent class:
Click Class Settings, and under Class Options, in the Parent Class drop-down select the wanted parent class (superclass).
Calling the Parent Class’s event functions:
When creating a BP class that is defined as child class in its creation this is done automatically
Right-Click the current class’s Event icon, and select Add call to parent function:
Connect the execution flow graph, and other inputs if necessary:
Had some frustrating time not understanding why doesn’t the FirstPersonProjectile Actor doesn’t “play ball” and generate Overlap Events when hitting my bad guys..
It turns out I had to change its collision (sphere) component’s collision settings to overlap dynamic objects (see image):
The example explained in this article is creating a blend between a mud material, and a mud-leaves material using a mask (Alpha) texture.
>> The scanned PBR materials in demonstrated in this post are from Texture Haven (texturehaven.com)
How does it work? There is actually no blending of Unreal materials, but rather a regular Unreal material in which each of the parameters is defined as a linear blend between 2 different source values for that parameter.
We could create such a material blueprint that uses a Lerp (Linear Interpolate) node’s to provide each of the material parameters with a blend of 2 input textures/colors or parameters, connecting the alpha texture to all the Lerp nodes’s Alpha input, and effectively achieve blending of 2 different materials, but it would be a complex blueprint in which it’s very inconvenient to design each of the individual materials participating in the blend:
This complexity can be greatly simplified by collecting each of the participating materials parameters into a Material Attributes data structure.
The Material Attributes data structure contains all the data needed to compile a material, and allows input, output, and processing of this data as a single blueprint data stream (connection).
For example, when the material parameters are grouped as a Material Attributes data structure, they can be blended by connecting them into a single BlendMaterialAttributes node, instead of “Lerping” (blending) between 2 inputs to create each individual material parameter, which produces an unworkable complex material blueprint like the previous example.
> To collect material parameters into a Material Attributes data structure, connect them into a MakeMaterialAttributes node:
> To create a blend between 2 Material Attributes data streams, use the BlendMaterialAttributes node:
* The Alpha parameter determines the weights of the blend (a black and white texture can be connected to it as the blend mask)
> In order for the material output to receive a grouped Material attributes input instead of individual inputs for each parameter, select the material output, and in the Details panel, check the Use Material Attributes option:
Using the Material Attributes data structure, the blended material’s Blueprint in now much simpler and cleaner, while producing the exact same result as before:
But designing 2 different materials within one material Blueprint is still far from being ideal..
What if we want to use just one of these materials on some surfaces?
What if the individual materials are not as simple as the materials shown here, it would be mush more efficient to be able to have one Blueprint for each of the materials allowing to focus on its development and preview it.
We can achieve this desired workflow by developing each of the materials as a Material Function.
Each of the participating materials is created as a Material Function with a Material Attributes output.
> One of the huge advantages of UE4’s material editing is that it allows us to preview a full material while developing it as a Material Function.
* This may sound trivial, but it isn’t. the Material Function isn’t compiled by itself as a material, it just produces data needed to define a material. in many other media production systems, this would have meant that you can develop data within the function but only preview it in the main material where the function is used.
The Material Function defining the mud-leaves material:
The Blend material using the Material Function nodes:
When blending a non-metallic material with a metal material, the alpha values (mask colors) should be only 0 or 1 (black or white), otherwise blend areas that have a mid-range metallic value will make no sense visually.
> A RemapValueRangenode can be used to force a color threshold on the mask texture or value.
To create animations and trigger them to play on game start:
First create a Level Sequence containing the animation:
Create a new Level Sequence actor:
Name the new Level Sequence and drag it to into the level:
Select the actor you want to animate in the level and double click the Level Sequence in the Content Browser to open it in the Sequencer window:
In the Sequencer window, press the +Track button to add a sequence track, choose the upper most option Actor To Sequence, the option to Add the selected actor will automatically appear first on the menu that will open on the right:
Add the selected actor as a sequence track, expand the track’s Transform channels to reveal the Transform property you would like to animate, and click the + button for that channel to create the first key-frame:
Activate the Create when channels/properties change option button:
Move the time slider to a desired time for the motion and move/change the actors transform to create a new key-frame:
The Level Sequence now contains animation for the Actor, but when we play the game, the animation doesn’t play.
For the animation to play in game, we must trigger it fro a Blueprint, in this case the Level Blueprint:
From the Editor Blueprints menu, choose Open Level Blueprint:
In the Level Blueprint, drag the Event BeginPlay execution graph and create CreateLevelSequencePlayer node that will follow it:
Drag the CreateLevelSequencePlayer node’s Return Value output and create a Play node that will be executed after it and receive it’s output:
The Level Blueprint now has instructions to play a Level Sequence,
but it’s not yet specified which Level Sequence to play:
In the Variables list on the left, press the +Variable button to create a new variable and name it:
With the new variable selected, in it’s details on the right, press the Variable Type button, and locate Level Sequence – Object Reference type:
The Level Blueprint now contains a variable named seq of type: Level Sequence – Object Reference:
Drag the new variable to the Blueprint and choose Get when placing it:
Connect the variable’s output to the Level Sequence input of the CreateLevelSequencePlayer node:
With the variable selected, in the details panel on the right, select the Level Sequence object it will be referencing:
Press Compile and save the Level Blueprint:
The Level Blueprint now has instructions to play the desired Level Sequence when the level begins playing so a the animation we created plays when we hit play game in the editor:
Basic steps for packaging a simple UE4 project for Windows:
Open the Project Settings window:
In: Project > Description
Set the project’s details and thumbnail:
> The Project thumbnail will apear in the UE4 Editor browser.
> Thumbnail image must be a 192 x 192 resolution PNG
In: Project > Maps & Modes Set default level (Map) for the project:
In: Project > Packaging
Choose build configuration
> For final distribution choose ‘Shipping‘:
In: Project > Supported Platforms:
Make sure Windows is selected:
Setting user input focus:
* So the user doesn’t have to mouse click the screen before being able to control the game.
Select the FirstPersonCharacter Actor and enter editing mode.
In the Event Graph Blueprint, locate the Event BeginPlay node, add a Set Input Game Only node, after it, and connect a Get Player Controller node set to index 0, to it’s Player Controller input:
Note that if there are UI user interactions, in the game, you may need to switch to different input modes during the game to allow interaction with UI.
Adding a Quit command:
Select the FirstPersonCharacter Actor and enter editing mode.
In the Event Graph Blueprint, add an Escape key press Event node,
And connect it to a Quit Game command node.
Creating the game package: Choose:
File > Package Project > Windows > Windows (64-bit) And select an output folder.
A folder named “WindowsNoEditor” will be created,
And inside it will be the game executable along with code and assets folders.
This package can be renamed and copied to other locations.
Possible causes for packaging failure: There are many reasons packaging a UE project can fail,
I certainly don’t know all of them, but I’ll list some cases I actually encountered:
If the project folder is located within a deep folder structure, packaging errors may occur because of long file paths.
* Sorry I didn’t save the actual error message..
Installing a plugin twice by mistake will cause the following error: Error: System.ArgumentException: An item with the same key has already been added. * I mistakenly installed the Houdini engine plugin both in the Plugins\Runtime folder and in the Plugins folder (this specific plugin should be only in Plugins\Runtime).