28
Unreal Engine Best Practices for VR Luis Cataldi – Epic Games, Education Evangelist

Luis cataldi-ue4-vr-best-practices2

Embed Size (px)

Citation preview

Page 1: Luis cataldi-ue4-vr-best-practices2

Unreal EngineBest Practices for VR

Luis Cataldi – Epic Games, Education Evangelist

Page 2: Luis cataldi-ue4-vr-best-practices2

VR Learning Resources for Unreal Engine:  Docs:

▪Getting Started With VR▪UE4 VR Index Page▪VR Best Practices▪VR Cheat Sheets▪Oculus Quick Starts▪GearVR Quick Starts

Video:▪Integrating the Oculus Rift into UE4 ▪UE4 Support Stream - Developing for VR ▪2015 UE4 - VR and Unreal Engine▪Unreal Engine 4 Training Stream: Up and Running with Gear VR

Presentations:▪ UE4 VR - Niklas Smedberg▪ Lessons from Integrating the Oculus Rift into UE4

Links:▪ Getting Started with VR in Unreal Engine 4

2

Page 3: Luis cataldi-ue4-vr-best-practices2

Things to keep in at the front of your mind:World ScaleGetting the scale of your world correct is one of the most important things to help deliver

the best user experience possible on VR platforms. Having the wrong scale can lead to

all kind of sensory issues for users and could even result in Simulation Sickness. Objects

are most easily viewed in VR when they are in a range of 0.75 to 3.5 Meters from the

player's camera. Inside of UE4, 1 Unreal Unit (UU) is equal to 1 Centimeter (CM).

This means that object's inside of Unreal are best viewed when they are 75 UU to 350

UU away from the player's camera when using VR.

3

Distance Distance in Unreal Units(UU)

1 Centimeter 1 Unreal Unit

1 Meter 100 Unreal Units

1 Kilometer 100,000 Unreal Units

Page 4: Luis cataldi-ue4-vr-best-practices2

Things to keep in at the front of your mind:World Scale

You can adjust the scale of your world in the World to Meters variable that is located under World Settings in side of UE4. However exercise caution when adjusting the scale of your world as again, selecting the wrong scale could lead to a disconnection between the world and the user which could lead to simulation sickness.

4

Page 5: Luis cataldi-ue4-vr-best-practices2

Things to keep in at the front of your mind:VR Character Settings

The setup for a character using a VR headset is slightly different than for a standard character. Things like character Height, Width, Speed, and Camera Location all need to be slightly modified to accommodate a VR character.

5

Page 6: Luis cataldi-ue4-vr-best-practices2

Things to keep in at the front of your mind:VR Character Settings

Character Height & Width

Character Height & Width should mimic real life measurements as much as possible. Using sizes that are too big or two small could ruin the emersion that you are trying to achieve.

6

Property UE4 Default Recommended VRHeight: 192 CM 176 CMWidth: 84 CM 68 CM

Page 7: Luis cataldi-ue4-vr-best-practices2

Things to keep in at the front of your mind:VR Character Settings

Movement Speed

VR movement speed is a difficult property to recommend a setting for because the movement speed that you choose will mainly be determined by the type of experience that you are trying to achieve. In the Elemental VR demo for example, the movement speed was cut to about 1/4 normal speed.

7

Property UE4 Default Recommended VRMovement Speed: 60 M/S 24 M/S

Page 8: Luis cataldi-ue4-vr-best-practices2

Things to keep in at the front of your mind:VR Character Settings

Camera Location

The VR camera needs to be positioned slightly lower than the base eye height to compensate for being at the characters eye level.

8

Property UE4 Default Recommended VRBase Eye Height: 180 CM 160 CM

Page 9: Luis cataldi-ue4-vr-best-practices2

Things to keep in at the front of your mind:

Make sure your project is running at your HMD's target

frame rate before you build or add anything to your world.

 

9

Page 10: Luis cataldi-ue4-vr-best-practices2

Things to keep in at the front of your mind:

Check your performance constantly to ensure that you are

hitting your VR performance targets.

10

Page 11: Luis cataldi-ue4-vr-best-practices2

Things to keep in at the front of your mind:

○ Maintain a very simplistic approach to making your

content.  ○ Minimize complex shaders as best possible. ○ Add detail to the mesh within reason in lieu of relying of

complex shaders for surface details.

11

Page 12: Luis cataldi-ue4-vr-best-practices2

Things to keep in at the front of your mind:

LOD's and aggressive culling are a must to ensure that you

are hitting your VR performance targets.

12

Page 13: Luis cataldi-ue4-vr-best-practices2

Known issues and possible workarounds:

Screen Space Reflections(SSR)

SSR will work in VR but not give you the results that you want and instead

you should look into using reflection probes.

13

Page 14: Luis cataldi-ue4-vr-best-practices2

Known issues and possible workarounds:

Normal Mapping Issues  

When viewing Normal maps on objects in VR, you will notice that they do not

have the impact that they might have once had. This is because normal

mapping does not account for a binocular display or motion parallax. Because

of this, Normal maps will come out looking flat when viewed with a VR device.

To get around this, you can do one of two things.

14

Page 15: Luis cataldi-ue4-vr-best-practices2

Known issues and possible workarounds:

Parallax Mapping  

Parallax mapping takes Normal mapping to the next level by accounting for

depth cues, Normal mapping does not. A Parallax mapping shader can better

display depth information, making objects appear to have more detail than

they do. This is because no matter what angle you look at, a Parallax map will

always correct itself to show you the correct depth information from that view

point. The best use of a Parallax map would be for cobblestone pathways and

fine detail on surfaces.15

Page 16: Luis cataldi-ue4-vr-best-practices2

Known issues and possible workarounds:

Tessellation Shader Displacement  

Tessellation Shader Displacement will displace 3D Geometry in real time by

adding details that are not modeled into the object. Tessellation shaders do a

great job of displaying information because tessellation shaders actually

create the missing detail by creating more vertices and displacing them in 3D

Space.

16

Page 17: Luis cataldi-ue4-vr-best-practices2

New Project Settings:When creating a new project for VR it is best to create a project that uses the Mobile /

Tablet setting with Scalable 3D or 2D and No Starter Content. If you need content

you should port / import only what you need and not everything you have.

17

Page 18: Luis cataldi-ue4-vr-best-practices2

Launching VR Preview:Testing out your VR set is very straightforward, simply select “VR Preview” from the Play

dropdown button. By default the head tracking will work right away without any changes

to your existing project or template.

18

Page 19: Luis cataldi-ue4-vr-best-practices2

Using VR in Blueprint:Using VR in Blueprint is very straightforward.

You will need a Camera Component and optionally one or two Motion Controllers Components. By default your Camera is already set up for HMD support, if you wish to disable rotation changes from the HMD you can disable “Lock to HMD” in the Component’s properties.

19

Page 20: Luis cataldi-ue4-vr-best-practices2

Performance Considerations:

For the VR experience to feel smooth, your game needs to run on 75 hz (Oculus DK2) or even 90 hz. (HTC Vive and Oculus CV1) depending on the device. To see the current framerate type in “stat fps” or “stat unit” (for more detailed breakdown) in your console when running the game.

20

Page 21: Luis cataldi-ue4-vr-best-practices2

GPU Profiling:To capture a single frame with GPU timings press Ctrl+Shift+, or type in “profilegpu” in the console. This command dumps accurate timings of the GPU, you will find that certain processes are a heavy burden on the framerate (Ambient Occlusion is one common example) when using VR.

The GPU Profiling & Performance and Profiling docs are a good place to learn about profiling your game.

21

Page 22: Luis cataldi-ue4-vr-best-practices2

Instanced Stereo:The latest 4.11 release introduces Instanced Stereo Rendering, check the video below for a comparison video of how that works.

“Basically, we’re utilizing hardware instancing to draw both eyes simultaneously with a single draw call and pass through the render loop. This cuts down render thread CPU time significantly and also improves GPU performance. Bullet Train was seeing ~15 – 20% CPU improvement on the render thread and ~7 – 10% improvement on the GPU.” – Ryan Vance.

22

To enable this feature in 4.11 and above, go to your Project Settings and look for “Instanced Stereo” under the Rendering category.

Page 23: Luis cataldi-ue4-vr-best-practices2

Disable Heavy Post-Processors:Due to the demanding requirements of VR many of the advanced Post Processing features that you normally use should be disabled. To accomplish this you will need to do the following in your level.

• Add a Post Process(PP) volume to your level if there is not already one there.• Select the PP volume and in the Post Process Volume section enable the Unbound option so that the settings in

the PP volume will be applied to the entire level.

• Expand the Settings of the Post Process Volume and then go through each section and disable any active PP settings by enabling that property by clicking on it and then set the value from the default, usually 1.0, to 0 to disable the feature.

• When doing this you will not need to hit every section and set all the properties to 0. Instead first disable the really heavy hitting features like Lens Flares, Screen Space reflections, Temporal AA, SSAO, and anything else that might have an impact on performance.

• While a lot of the features are disabled by setting things in your .INI this ensures that nothing will happen to performance if someone deletes the .INI by mistake. 23

Page 24: Luis cataldi-ue4-vr-best-practices2

Static, Stationary and Dynamic Lighting:

You should always use Static lighting and lightmaps when making a VR project as this is the cheapest option to render. If you need to use dynamic lighting make sure to limit the amount of dynamic lights to as few as possible and make sure that they never touch one another. If you have an outdoor scene set your directional light to dynamic instead of stationary and then turn on Cascading Shadow Maps and set then adjust the settings to be as low as possible while still giving you shadows. This is going to take a lot of trial and error to get correct.

24

Page 25: Luis cataldi-ue4-vr-best-practices2

Fake shadows if you can:

Using things like fake blob shadow drop to simulate dynamic shadows are a good general rule in order to keep VR project running at frame.

25

Blob shadow example. Image by Eric Chadwick

Page 26: Luis cataldi-ue4-vr-best-practices2

VFX in VR:

Some VFX techniques like using SubUV Textures to simulate fire or smoke do not hold up well when viewed in VR. In many cases it can be more desirable to use static meshes emitters instead of 2D sprite particles to simulate VFX's like explosions or smoke trails.  Near field effects, or effects that happen very close to the camera can work well in VR but only when the effects are made up of Static Meshes particles.

26

Page 27: Luis cataldi-ue4-vr-best-practices2

Again, VR Learning Resources for Unreal Engine:

  Docs:

▪Getting Started With VR▪UE4 VR Index Page▪VR Best Practices▪VR Cheat Sheets▪Oculus Quick Starts▪GearVR Quick Starts

Video:▪Integrating the Oculus Rift into UE4 ▪UE4 Support Stream - Developing for VR ▪2015 UE4 - VR and Unreal Engine▪Unreal Engine 4 Training Stream: Up and Running with Gear VR

Presentations:▪ UE4 VR - Niklas Smedberg▪ Lessons from Integrating the Oculus Rift into UE4

Links:▪ Getting Started with VR in Unreal Engine 4

27

Page 28: Luis cataldi-ue4-vr-best-practices2

Thanks you! [email protected]

28