Creating a Basic VR Experience

This article covers the basic process of getting Rhino geometry into Unreal and adding some VR functionality and creating a basic experience.

Overview

This article will walk through the construction of a basic virtual reality experience that introduces the basic Unreal Engine Workflow. The purpose of this article is an introduction of the Unreal Engine process and concepts, and therefore will reinforce the steps and give more context to the Primer material.

This article will cover the process of:

  1. Preparing content for use in Unreal Engine

  2. Setting up a VR environment

  3. Importing content into Unreal Engine

  4. Adding texture and materials

  5. Lighting and Environment

  6. Navigation

  7. Packaging and Running

Resources

This article expects an understanding of Unreal Engine, refer to the Unreal Engine Primer.

pageUnreal Engine Primer

Rhino3D

For the purposes of this article, we will be using Rhino3D to prepare the experience content. The example shown in this article is of the Farnsworth House.

Content Preparation

Content created for use in Unreal Engine should follow these few guidelines.

Modelling

  1. When modelling, keep in mind that materials are applied to each individual object in Unreal Engine, so for surfaces that have different materials make sure to divide them into their own objects.

  2. Geometry should initially be sorted into two groups:

    • Main or unique objects, for example, the building itself.

    • Duplicatable object, for example, chairs and furniture. Delete any extras to leave only one instance of the object to export, it can be duplicated in Unreal Engine.

  3. Then sort all the geometry into layers based on the material type, and then geometrical likeness. We do this so a material can dedicated to one group of geometry and changes can be made on the group instead of individually.

For a simple workflow, objects should be individual elements to make the material application process easier, so model accordingly.

Nurbs or Meshes

While you may model using Nurbs or Meshes in Rhino, all content needs to be as triangular meshes for Unreal Engine. Therefore, the mesh content should be geometrically as simple as possible, complicated meshes with many faces can lead to Lighting and Material issues.

When exporting for Unreal Engine, it will prompt for a conversion to mesh anyway if there is any nurbs geometry. Note that Disjointed Rhino meshes will import as a single object. To have a finer control over the meshing process, pre-mesh the nurbs model using the mesh command

  1. Select the nurbs geometry, this should be done individually for finer control

  2. Enter [Mesh] into the command line to begin the conversion process.

  3. Adjust the polygon amount, it is good practice to keep the polygon count as low as possible without distortion the intended geometry. If applicable, use [Detailed Controls] for further control.

  4. [Preview] to check the results.

  5. [Okay] to finalise meshing.

To reduce the complexity of a mesh:

  1. Select the mesh geometry to alter

  2. Enter [Reduce Mesh] into the command line to begin the reduction process.

  3. You use either a polygonal count method, or a percentage reduction method. Points can also be locked for features that should not be reduced in complexity.

  4. [Preview] to check the results.

  5. [Okay] to finalise.

Preparation: Naming

Objects should be renamed and given an appropriate suffix so they can be easily identified upon transition to Unreal Engine. For similar objects without a need for unique identification, they are usually numbered indiscriminately, e.g: SM_Timber001, SM_Timber002... etc.

Refer to the following article for best practice in content management:

pageActors: Components, Content and Editors
  1. Assuming that your file has been set up with layers based on materials and object like-ness, select the group, e.g: [RMB on Layer, Select Objects]

  2. [SetObjectName] to begin the process, ensure[AppendCounter= Yes]

  3. Name the group, check in the object properties, note that they have been named and numbered.

Preparation: UV Mapping

For our example file, all objects have a basic uniform Box Mapping UV applied.

All geometry should be Texture UV and Light UV mapped for optimal control over the visual appearance of the content. Unreal Engine has an automated process for UV mapping upon content import, but best practice should be to use custom mapping.

This article will not directly cover UV mapping for texturing, instead an in-depth guide on what Texture/Light mapping is and the process can be found here:

pageUV and Lightmaps

Exporting Content

Main Content

  1. Use the [ExportWithOrigin] command so there is always a reference point you can use.

  2. Choose the point in the model that will become the origin point in Unreal Engine. You may use the World Origin ( [0,0,0] or press Enter) for easier alignment in the future if you make edits to the geometry or need to add extra geometry. You may also use a fixed part of the model instead to always be the reference.

  3. When prompted, save as a .fbx file.

  4. Choose an appropriate Mesh Detail Level if there are things left to mesh.

  5. Export with these settings: Meshes Only, Do NOT Map Rhino Z to FBX Y, Version 7 Binary. The other options do not matter so much as we will not be using Rhino materials. For other programs like Maya or 3DS Max, which have dedicated Unreal Engine pipelines, materials should be packaged.

Instance Content

  1. Repeat the process above using [ExportWithOrigin] but for each object individually with the following change:

  2. When choosing a point in the model that will become that objects origin point in Unreal Engine, select a point on the object itself that will make it easy to track. In the example above, the chair leg is being chosen as it is an easy to identify point and is where it contacts the floor.

In this example, we are left with these files, a main Farnsworth Demo, and instances of the furniture:

Unreal Engine

Building & Playing

Building and Playing is a common part of the workflow. This article will remind you to [Build] at certain points, but testing and validating the experience at multiple points is part of the workflow and should be done at every milestone.

pageProcess: Level Building, Playing & Packaging

File Setup

To set up a VR-ready file, refer to this guide:

pageSetting up a VR-ready File & Templates

File Overview

We've created a new project with a clone of the modified VR Motion Controller Level. In this Level we have:

1. The Level

2. The sky is composed of the following set of Actors: a Light Source, a Sky Light and a Sky Sphere Blueprint. The Light Source and Sky Sphere are interlinked as an editable sun/sky system.

3. The VRPawn is the player representation. Ensure that Auto Possess Player is set to Player 0 and Auto Possess AI is Disabled. This ensures that upon running the experience for testing or as the final package, the player's VR HMD will register automatically and not anything else.

Level Building

Importing an FBX model in to Unreal

Set Up the File Structure

  1. Create a StaticMeshes folder for your import content in the Content Browser, using the [Add New button] or [RMB], and further folders for each .fbx file.

  2. To import content, [Drag & Drop the file] or use the [Import] button.

For a refresher on Content and good practice for managing all of your content, refer to:

pageActors: Components, Content and Editors

Import Options

Upon import, a FBX Import Options menu will pop up, use these options:

  1. Under Mesh, toggle Auto Generate Collision Off

  2. Expand the Mesh tab, toggle Generate Lightmap UVs On, this will automatically generate Lightmaps. If you have a custom Lightmap channels set for the file already, leave this off.

  3. Under Miscellaneous, toggle Convert Scene On.

  4. Under Material, Import Materials Off and Import Textures Off, as Rhino3D textures do not translate well into Unreal Engine.

All geometry will be imported as individual objects as per Rhino, but will be named appropriately.

Placing Content

Main Content

  1. Select all the relevant Geometry. In this example it will be all the geometry that comprises the building.

  2. Drag Drop content from Content Browser into the viewport. Adjust the location back to [0,0,0] if necessary.

  3. In the World Outliner, group all the objects into a folder using [RMB > Move to > New Folder].

Instance-able Content

Create a Blueprint for each instance-able content if it is comprised of many parts. This allows for the packaging of it back into one manageable file that can be made into an actor many times.

  1. In the Content Browser, create a new blueprint using [RMB] or the [Add New Button]

  2. Select the Actor Class upon being prompted.

  3. Even though this is a Blueprint, since it is used only to hold a few meshes, name it appropriately using the SM_ suffix. In our example this is a Blueprint for SM_Chair1

Now let's use the Viewport in the Blueprint and import the instance-able content.

  1. Open the Blueprint.

  2. Drag and Drop the content from the Content Browser.

  3. The DefaultSceneRoot determines the origin of this Blueprint. Use it or make one of the object components the root by dragging it onto the Root to replace it. In the example above, the chair has been positioned to have the Root as its centre on the ground level.

  4. [Compile] and [Save] the Blueprint, it is now ready to use. Try dragging the Blueprint out onto the scene.

Repeat for as many instance objects that you have, making sure you keep the World Outliner tidy:

For a refresher on Blueprints, refer to:

pageInteractivity & Blueprints

Materials

Creating Materials

With all the geometry Actors in place in the Level, they can now be textured. The in-depth guide to Materials and Textures is here:

pageMaterials & Textures

For this example we will be using a mix of the custom Materials and Materials from the Starter Content.

  1. Create a Materials folder in the Content Browser root if it has not been made yet, store all materials in here.

  2. [RMB] or [Add New] to create a new material.

  3. Name it with the suffix M_ and the material name.

  4. Open it via double-clicking. The Material Editor window will pop up.

  5. Adjust the material and save.

Application and Adjustment

  1. From the World Outliner, as all the Actors have been named specifically, they can be selected in groups to be assigned a material all at once.

  2. To assign a material, either:

    • Drag and drop the Material slot into the Details

    • Use the Dropdown menu in the Material slot and search for it.

    • If it is a singular object, the material can also be dragged and dropped over the object in the Viewport.

  3. If a material needs to be adjusted, adjust it through its Material Editor and from the top menu [Apply] to preview, and [Save] to commit changes.

Instance-able Blueprint Materials

  1. Create any necessary materials.

  2. Open the Blueprint Actor and ensure it is in the Viewport tab.

  3. Like using the World Outliner, assign a material as you normally would through the Details panel

  4. This will update all instances of the Actor in the Level.

  5. If a material needs to be adjusted, adjust it through its Material Editor and from the top menu [Apply] to preview, and [Save] to commit changes.

Repeat this process for all the geometry Actors. [Build] the Lighting.

Environment

Now that the base Level has been set up, the atmosphere can be enhanced through Lighting and other Visual effects. For this example, we will add lights, fog and a Post-processing Volume.

Lighting

Skybox

The sky and sun can be adjusted using the Light Source and SkySphereBlueprint. The default Level Lighting is comprised of the following Actors:

  1. The Light Source, which is a directional light. Change this angle to adjust the direction of the sun.

  2. The Skylight, that helps in directing light to the scene, keep this close around the content.

  3. The SkySphereBlueprint, which is a built-in Engine resource. This Blueprint comprises the sun and sky background, and upon changing the direction of the Light Source, it can be updated to reflect the changes under the Details panel and [Refresh Material]. Cloud control and stars also exist among other parameters.

  4. [Build]

Light Actors

  1. [Place Mode > Lights] is where to find Unreal Engine's default lights.

  2. Drag and drop into the scene and manipulate as necessary. In this example, lights are being used to supplement the ambient light of the interior.

  3. In this example, we will also be using a Sphere Reflection Capture, which is found under

    [Place Mode > Visual Effects] to boost the reflected shadows.

  4. [Build]

If materials and shadows do not look correct after building, the lightmap resolution for that object may need to be adjusted. In this example, all the large slab like elements saw an increase of resolution.

For a detailed primer on Lighting:

pageLighting & Mobility

Visual Effects

  1. [Place Mode > Visual Effects] is where to find Unreal Engine's default effects.

  2. Drag and drop the desired effect into the Level, and adjust via the Details panel.

For this example, a Exponential Fog and a Post-Processing Volume will be used to bolster the atmospheric and visual aesthetic.

For a detailed list of effects refer to:

pageActors: Components, Content and Editors

Interactivity

To enable the Level to be walked on and through, and in the case of this VR-file, to be enable teleportation, collision needs to be added to all the geometry Actors:

pageInteractivity & Blueprints

Collision

  1. Decide on the 'ground' content; content that should be walked on and/or should accept teleportation to. Open up the meshes one by one.

  2. Determine what counts as collision bounds.

  3. Add an appropriate collision through the top [Collision] menu.

  4. View it using [Collision > View Simple Collision]

  5. Simple Collision is represented through a green mesh.

For this example, all the ground slabs are given Simple Box Collisions. For more complex geometry in your projects, like the stairs and boundary collision in this example, they can be dealt with using a Custom Collision:

pageCustom Collision and Navigation

Packaging

Build, play and test the project and make adjustments to any materials and effects fo complete the design of the experience. When it is finished, it is ready for distribution.

  1. [File > Package Project]

  2. [Build Configuration > Shipping]

  3. Enable Full Rebuild through [Packaging Settings > Toggle Full Rebuild]

  4. Back in [File > Package Project] choose the [Windows platform > 64bit].

  5. Go through the Saving dialogue

This will output a project folder with a .exe file that can copied and distributed, and ran on a VR-enabled machine.

Last updated