Skip to content

UE4 Plugin Getting Started Guide

Adam Marrs edited this page Feb 12, 2021 · 6 revisions

This guide is meant for individuals who are interested in using the RTXGI UE4 Plugin but don't yet have experience using a version control system (e.g. Git). Since the RTXGI plugin modifies small portions of the Unreal Engine source code, it is a bit tougher to get up and running compared to plugins from the Unreal Marketplace. Hopefully this guide will save you time and headaches. I'll try to periodically update the guide with common solutions and workarounds to issues people run into.

Choosing an Engine Version

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.x".

Whatever the constraints are that drive your engine version choice, know that the RTXGI UE4 plugin supports Unreal Engine versions 4.26.1, 4.26.0, 4.25.4, and 4.24.3. The plugin may work with other (older) engine versions, but we haven't tested them, don't support them, and as a result don't recommend using them with RTXGI.

In addition to "vanilla" UE4, the RTXGI plugin is also compatible with the NVIDIA UE4 branch (also known as NvRTX). NvRTX includes optimizations for NVIDIA RTX GPUs and enhancements to the DXR support found in UE4. It is ideal for developers adding ray tracing to their games and applications. You can sign up for access to NvRTX here.

Using Git

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.

  1. 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.

  2. Configure GitExtensions: once GitExtensions is installed, open it, and select Repository->Repository Settings. In the Line Endings section of the window that appears, select the Checkout 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.

Cloning the Source Code

Now that you have GitExtensions setup, you need to clone the Unreal Engine and RTXGI plugin source code.

  1. 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. Select Yes to these prompts.

  2. 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.

Setting up the Engine

  1. 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 and GenerateProjectFiles.bat are stored. Double click on Setup.bat to run it. This will open up a command prompt that downloads and installs dependencies that UE4 needs to work.

  2. Copy the RTXGI Plugin patch: once Setup.bat has finished, copy the RTXGI plugin patch file from the ue4-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 for NvRTX 4.26.0, the UE4 root directory will include the RTXGI-NvRTX4.26.0.patch file.

Install the RTXGI Plugin

  1. 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.

  2. 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 NvRTX 4.26.0 the command is:

    git apply --check RTXGI-NvRTX4.26.0.patch
    

    and installing the plugin for "vanilla" UE 4.26.0 the command is:

    git apply --check RTXGI-UE4.26.0.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.

  1. 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 the plugin for NvRTX 4.26.0 the command is:

    git apply RTXGI-NvRTX4.26.0.patch
    

    and installing the plugin for "vanilla" UE 4.26.0 the command is:

    git apply RTXGI-UE4.26.0.patch
    

After the above command finishes, new files for RTXGI plugin will exist in Engine/Plugins/Runtime/Nvidia/RTXGI/.

Build it, run it!

  1. Generate the Visual Studio Solution: now that all the engine and plugin files are in place, double click GenerateProjectFiles.bat to create the UE4.sln Visual Studio solution file. Once the command finishes, open UE4.sln and build the UE4 project. This will take a while.

  2. 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.

  3. 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.
  4. Place DDGIVolume actors in the scene and enjoy ray traced dynamic diffuse global illumination!

Clone this wiki locally