clean wiki authored by David Gilbert's avatar David Gilbert
**Table of Contents**
[[_TOC_]]
## Overview
Here is explained how to add our template to Unreal Engine and how to use it.
- VR Group Unreal Template: [Link](https://git-ce.rwth-aachen.de/vr-vis/VR-Group/unreal-development/unrealprojecttemplate)
- RWTH VR Toolkit Plugin: [Link](https://git-ce.rwth-aachen.de/vr-vis/VR-Group/unreal-development/plugins/rwth-vr-toolkit)
- RWTH VR Cluster Plugin: [Link](https://git-ce.rwth-aachen.de/vr-vis/VR-Group/unreal-development/plugins/rwth-vr-cluster-plugin)
- RWTH VR DTrack Plugin ([fork of ART](https://github.com/ar-tracking/UnrealDTrackPlugin)): [Link](https://github.com/VRGroupRWTH/UnrealDTrackPlugin)
## Adding the Template to Unreal Engine
Just clone the [template repository](https://git-ce.rwth-aachen.de/vr-vis/VR-Group/unreal-development/unrealprojecttemplate) to the `Templates` folder of your Unreal Engine installation.
```bash
# go to your local Unreal Engines' templates directory
# (e.g. C:/Unreal/UE_5.3/Templates)
cd your/UnrealEngine/Templates
# clone branch according to your Unreal version (here 5.3)
git clone -b 5.3 https://git-ce.rwth-aachen.de/vr-vis/VR-Group/unreal-development/unrealprojecttemplate.git
```
There are also [official docs](https://docs.unrealengine.com/5.3/en-US/converting-a-project-to-an-unreal-engine-template) for adding a project as a template.
## Creating a new Project
When [creating a new Project](https://docs.unrealengine.com/5.3/en-US/creating-a-new-project-in-unreal-engine/) using Unreal you can find the template under `New Project -> C++ -> RWTH-VR`.
Then you should:
1. Add plugins
2. Change the remote to your personal repository
3. *Optional:* Create/Remove branches
4. Push to your personal repository
## Adding Plugins to a Project
A plugin is simply saved in the `Project_Folder/Plugins/` folder. This can be either done via copy or by adding a git submodule.
As git submodules offer much more versatility (update the Plugin, change branches, ...) and are therefore preferred. See below for an example.
```bash
# Go to your project folder
cd my/project
# Add the rwth-vr-toolkit plugin as git submodule
# (here the dev/5.3 branch is used, adapt to your unreal version)
git submodule add -b dev/5.3 https://git-ce.rwth-aachen.de/vr-vis/VR-Group/unreal-development/plugins/rwth-vr-toolkit.git ./Plugins/rwth-vr-toolkit
# Add the rwth-vr-cluster-plugin as git submodule
# (here the dev/5.3 branch is used, adapt to your unreal version)
git submodule add -b dev/5.3 https://git-ce.rwth-aachen.de/vr-vis/VR-Group/unreal-development/plugins/rwth-vr-cluster-plugin.git ./Plugins/rwth-vr-cluster-plugin
# Add the dtrack plugin as git submodule
git submodule add https://github.com/VRGroupRWTH/UnrealDTrackPlugin.git ./Plugins/DTrack
# If you want to remove a plugin added as submodule:
# git rm ./Plugins/Stupid_Plugin
# (add --force if it doesn't work without)
```
#### Necessary Plugins
- [RWTH VR Toolkit Plugin](https://git-ce.rwth-aachen.de/vr-vis/VR-Group/unreal-development/plugins/rwth-vr-toolkit)
- [RWTH VR Cluster Plugin](https://git-ce.rwth-aachen.de/vr-vis/VR-Group/unreal-development/plugins/rwth-vr-cluster-plugin)
- [DTrack Plugin](https://github.com/VRGroupRWTH/UnrealDTrackPlugin)
#### Some additional plugins (non-exclusive)
- [Unreal Study Framework Plugin](https://git-ce.rwth-aachen.de/vr-vis/VR-Group/unreal-development/plugins/unreal-study-framework)
- [Universal Logging Plugin](https://git-ce.rwth-aachen.de/vr-vis/VR-Group/unreal-development/plugins/universallogging)
- [Unreal VA Plugin](https://git-ce.rwth-aachen.de/vr-vis/VR-Group/unreal-development/plugins/unreal-va-plugin)
- [Character Plugin](https://git-ce.rwth-aachen.de/vr-vis/VR-Group/unreal-development/plugins/character-plugin)
## Update Repository
The created project still points to the [template repository](https://git-ce.rwth-aachen.de/vr-vis/VR-Group/unreal-development/unrealprojecttemplate).
Thus, you now need to configure git to point at your personal repository for this project and push it.
Additionally you can configure more, e.g. which branches to create or delete before pushing.
```bash
# Setup new remote
# ----------------
# rename origin remote to template origin
git remote rename origin template_origin
# add new remote pointing to your repository
git remote add origin https://git-ce.rwth-aachen.de/OWNER/REPOSITORY.git
# Optional: Create/Delete Branches
# --------------------------------
# Checkout to develop
git checkout -b develop
# List all branches (locally)
git branch
# Delete any branch you want (locally)
git branch --delete [branchname]
# Push to Repository
# ------------------
git push -u origin --all
git push -u origin --tags
```
### Potential Fixes
If LFS makes some problems, try below commands.
```bash
git lfs install # Needs only to be done once per machine
git lfs fetch --all origin # Download LFS content
```
If git is annoyed about your upstream, you may try this command.
```bash
# Fix potential upstream annoyance
git branch --unset-upstream
git push --set-upstream origin develop # Assuming you have the develop branch checked out locally
```
## Open your Project
There are [multiple ways](https://docs.unrealengine.com/5.3/en-US/opening-an-existing-unreal-engine-project/) how to open/start your fresh project.
#### Open directly with Editor
Just double click the `(ProjectName).uproject` file in your project folder.
#### Open with IDE
For this you first need to generate a VS Solution file (`.sln`).
Rightclick the `(ProjectName).uproject` file in your project folder and click on `Generate Project Files`.
Afterwars use [Visual Studio](https://visualstudio.microsoft.com/de/) or [Rider](https://www.jetbrains.com/de-de/rider/) to open the `(ProjectName).sln` file. Rider is an IDE tailored for Unreal development and [is free for students](https://www.jetbrains.com/de-de/community/education/#students).
If this does not work, make sure you installed all Visual Studio packages as listed [in the official docs](https://docs.unrealengine.com/5.3/en-US/setting-up-visual-studio-development-environment-for-cplusplus-projects-in-unreal-engine/#newvisualstudioinstallation)
### Configure Project
When opening the project the first time, it will probably need to rebuild dependencies. Everything should then work out-of-the-box.
Nevertheless, some things you should look out for:
- `Edit -> Project Settings -> Project -> Maps & Modes`
- `Default GameMode: RWTHVRGameMode` (unless you know what you're doing)
- `Editor Startup Map: YourMap` (choose the Level you want to open per default in editor)
- `Game Default Map: YourMap` (choose the Level you want to open per default in build)
- To show the content of the RWTH VR Toolkit in the [Content Browser](https://docs.unrealengine.com/5.3/en-US/content-browser-in-unreal-engine/), hit `Settings` on the Content Browser and check `Show Plugin Content`.
#### Preparing CAVE applications
If you want to deploy applications on CAVE, Vulkan is used as a renderer (due to Linux).
As the image and stability may very between DirectX and Vulkan, it is advised to equalize your Windows setup to the CAVE (Linux) Setup.
Below, we also adjust the Vulkan shader model to support SM6. This may introduce instability, but offers more up-to-date shader functions.
Check the Shader format for Linux in `Edit -> Project Settings -> Plattforms -> Linux` first:
- Targeted RHIs
- Check Vulkan Desktop (SM6) :heavy_check_mark:
Then check the Shader format for Windows in `Plattforms -> Windows` to match:
- D3D12 Targeted Shader Formats
- Check SM6 :heavy_check_mark:
- Uncheck everything else :x:
- D3D11 Targeted Shader Formats
- Check SM6 :heavy_check_mark:
- Uncheck everything else :x:
- Vulkan Targeted Shader Format
- Check SM6 :heavy_check_mark:
- Targeted RHIs: Vulkan
If development becomes unstable under Windows, switch back to D3D11.
#### Preparing HMD applications
As HMD apps are most probably running on Windows, you can adjust the settings in `Edit -> Project Settings -> Plattforms -> Windows` as you like.
\ No newline at end of file