-
Notifications
You must be signed in to change notification settings - Fork 56
UE4 Plugin Getting Started Guide
The RTXGI plugin now comes pre-installed in the NVIDIA RTX branch of UE4!
The fastest and easiest way to get started with RTXGI in UE4 is to download the latest version of the NVIDIA RTX branch of UE4 (also known as NvRTX).
Access to NvRTX is available to everyone! To use NvRTX, you’ll need a GitHub account and an Epic Games account that are linked. Instructions to do this are available at https://www.unrealengine.com/en-US/ue4-on-github. Once that process is complete, you will be able to access the NvRTX GitHub repository at https://github.com/NvRTX/UnrealEngine. Use the latest NvRTX and say goodbye to patches :-).
The RTXGI v1.1.30 plugin supports NvRTX 4.26.1. We strongly recommend using NvRTX since it includes many optimizations for NVIDIA RTX GPUs and enhancements to the DXR support found in mainline UE4. It is ideal for developers adding ray tracing to their games and applications.
If you cannot use NvRTX, but still want to use the RTXGI Plugin in UE4, you can patch your version of Unreal Engine using a RTXGI plugin patch. A patch is required since the RTXGI plugin modifies small portions of the Unreal Engine source code in order to do its work.
Hopefully this guide will save you time and headaches as you get setup with RTXGI.
Your first step is to choose a version of Unreal Engine 4 to work with. This may be as a simple as "I want the latest one" or as complicated as "I have project, asset, or platform constraints that require version 4.2x.y".
Whatever the constraints are that drive your engine version choice, know that the various versions of the RTXGI UE4 plugin support Unreal Engine versions 4.26.2, 4.26.1, 4.26.0, 4.25.4, and 4.24.3.
The RTXGI v1.1.30 plugin supports UE4.26.2 and 4.26.1. If you are using older 4.25 or 4.26 versions of Unreal Engine, the v1.1.23 plugin patches are still available and you should use those. You will need to upgrade to at least 4.26.1 to use the latest v1.1.30 plugin. All versions of the plugin may work with other (older) engine versions, but we haven't tested them, don't support them, and as a result do not recommend using them with RTXGI.
After you have decided on an engine version, you'll need to "clone" source code with Git. This uses the version control system to download the source code to your machine. Although you can download a zip archive of the engine source, we strongly recommend against this since it makes it difficult to install the RTXGI plugin and prevents you from easily receiving future updates to both the engine and the plugin.
-
Install GitExtensions: the first thing you'll want is a tool that makes using Git a bit easier. I recommend GitExtensions and it will be the tool used in this guide. Go to their site, download the installer, and run it. You can use the default settings in the installer.
-
Configure GitExtensions: once GitExtensions is installed, open it, and select
Repository->Repository Settings
. In theLine Endings
section of the window that appears, select theCheckout Windows-style, commit Unix-style line endings
option (see image below). This makes it so the line endings of files downloaded to your machine are in Windows format - a requirement for the RTXGI plugin to install properly.
Now that you have GitExtensions setup, you need to clone the Unreal Engine and RTXGI plugin source code.
-
Clone the Unreal Engine repository: in GitExtensions, go to
Start->Clone Repository...
. Enter in the details for the Unreal Engine repo you've chosen and where you want it to be stored on your machine. Then selectClone
and wait for the process to complete. This will take a while. Once the clone process is done, you'll see a few pop-ups in GitExtensions about tracking a remote and opening the repository. SelectYes
to these prompts. -
Clone the RTXGI repository: now that you have the UE4 engine source, you need to perform the same process to download the RTXGI source code. In GitExtensions, go to
Start->Clone Repository...
and enter in the details to clone the RTXGI GitHub repository to a new folder on your machine. This should be relatively quick and you'll get the same prompts about tracking a remote and opening the repository.
-
Engine Setup: now that you have all the source code files, navigate to where you chose to store the Unreal Engine source files on your machine. The UE4 root directory is where files like
Setup.bat
andGenerateProjectFiles.bat
are stored. Double click onSetup.bat
to run it. This will open up a command prompt that downloads and installs dependencies that UE4 needs to work. -
Copy the RTXGI Plugin patch: once
Setup.bat
has finished, copy the RTXGI plugin patch file from theue4-plugin
folder of the RTXGI source code to the UE4 source code root. Make sure to copy the appropriate patch file for the version of the engine you are using. For example, after completing Steps 5 and 6, the UE4 root directory will include theRTXGI-UE4.26.1.patch
file.
-
Open a Git Bash command prompt window in the UE4 root directory: if Git is installed properly, you should be able to do this using a right-click context menu option.
-
Check for compatibility: in the Git bash command prompt, run the below command to make sure the RTXGI patch and engine are compatible. If the plugin and engine are compatible the command will run and not output anything.
git apply --check RTXGI-[ENGINE-VERSION].patch
where
[ENGINE-VERSION]
is replaced with the selected engine and version number.For example, when installing the plugin for "vanilla" UE4.26.1 the command is:
git apply --check RTXGI-UE4.26.1.patch
If the above command outputs
patch does not apply
for any of the files, then it is likely the line endings of the engine and plugin source code do not match. This means your Git configuration was not correct before you checked out either the engine and/or plugin files.
You do not need to run any other variation of this command for the process to work. Some posts in the Issues forum suggest options to strip whitespace and this is not necessary if Git line ending settings are setup as described in this guide.
-
Install the plugin: in the same Git bash command prompt, run the below command to install the RTXGI plugin code in the UE4 repository. As with the compatibility check, if the command runs successfully it will not output anything.
git apply RTXGI-[ENGINE-VERSION].patch
where
[ENGINE-VERSION]
is replaced with the selected engine and version number.For example, when installing installing the plugin for "vanilla" UE 4.26.1 the command is:
git apply RTXGI-UE4.26.1.patch
After the above command finishes, new files for RTXGI plugin will exist in
Engine/Plugins/Runtime/Nvidia/RTXGI/
.
-
Generate the Visual Studio Solution: now that all the engine and plugin files are in place, double click
GenerateProjectFiles.bat
to create theUE4.sln
Visual Studio solution file. Once the command finishes, openUE4.sln
and build the UE4 project. This will take a while. -
Once the build finishes, set the UE4 project as the default startup project in Visual Studio. Do this by right-clicking on the UE4 project and selecting
Set as Startup Project
. Run the engine and open your project. -
Setup your project for RTXGI: ray tracing requires DirectX 12 in Unreal Engine 4. Set your project's default RHI to DirectX 12, enable Ray Tracing in the project settings, and enable the RTXGI plugin.
- Go to
Project Settings->Platforms->Windows->Targeted RHIs->Default RHI
and select DirectX 12. - Go to
Project Settings->Engine->Rendering->Ray Tracing
and check the box next to Ray Tracing. - Go to
Settings->Plugins->Lighting->NVIDIA RTXGI Plugin
and check the box next to Enabled.
- Go to
-
Place DDGIVolume actors in the scene and enjoy ray traced dynamic diffuse global illumination!