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.
Last updated
This article covers the basic process of getting Rhino geometry into Unreal and adding some VR functionality and creating a basic experience.
Last updated
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:
Preparing content for use in Unreal Engine
Setting up a VR environment
Importing content into Unreal Engine
Adding texture and materials
Lighting and Environment
Navigation
Packaging and Running
This article expects an understanding of Unreal Engine, refer to the Unreal Engine Primer.
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 created for use in Unreal Engine should follow these few guidelines.
Modelling
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.
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.
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.
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
Select the nurbs geometry, this should be done individually for finer control
Enter [Mesh]
into the command line to begin the conversion process.
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.
[Preview]
to check the results.
[Okay]
to finalise meshing.
To reduce the complexity of a mesh:
Select the mesh geometry to alter
Enter [Reduce Mesh]
into the command line to begin the reduction process.
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.
[Preview]
to check the results.
[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:
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]
[SetObjectName]
to begin the process, ensure[AppendCounter= Yes]
Name the group, check in the object properties, note that they have been named and numbered.
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:
Main Content
Use the [ExportWithOrigin]
command so there is always a reference point you can use.
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.
When prompted, save as a .fbx file.
Choose an appropriate Mesh Detail Level if there are things left to mesh.
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
Repeat the process above using [ExportWithOrigin]
but for each object individually with the following change:
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:
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.
To set up a VR-ready file, refer to this guide:
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.
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.
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:
Upon import, a FBX Import Options menu will pop up, use these options:
Under Mesh, toggle Auto Generate Collision Off
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.
Under Miscellaneous, toggle Convert Scene On.
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.
Select all the relevant Geometry. In this example it will be all the geometry that comprises the building.
Drag Drop content from Content Browser into the viewport. Adjust the location back to [0,0,0] if necessary.
In the World Outliner, group all the objects into a folder using [RMB > Move to > New Folder]
.
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.
In the Content Browser, create a new blueprint using [RMB]
or the [Add New Button]
Select the Actor Class upon being prompted.
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.
Open the Blueprint.
Drag and Drop the content from the Content Browser.
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.
[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:
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:
For this example we will be using a mix of the custom Materials and Materials from the Starter Content.
Create a Materials folder in the Content Browser root if it has not been made yet, store all materials in here.
[RMB] or [Add New] to create a new material.
Name it with the suffix M_ and the material name.
Open it via double-clicking. The Material Editor window will pop up.
Adjust the material and save.
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.
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.
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.
Create any necessary materials.
Open the Blueprint Actor and ensure it is in the Viewport tab.
Like using the World Outliner, assign a material as you normally would through the Details panel
This will update all instances of the Actor in the Level.
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.
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.
Skybox
The sky and sun can be adjusted using the Light Source and SkySphereBlueprint. The default Level Lighting is comprised of the following Actors:
The Light Source, which is a directional light. Change this angle to adjust the direction of the sun.
The Skylight, that helps in directing light to the scene, keep this close around the content.
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.
[Build]
[Place Mode > Lights]
is where to find Unreal Engine's default lights.
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.
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.
[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:
[Place Mode > Visual Effects]
is where to find Unreal Engine's default effects.
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:
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:
Decide on the 'ground' content; content that should be walked on and/or should accept teleportation to. Open up the meshes one by one.
Determine what counts as collision bounds.
Add an appropriate collision through the top [Collision]
menu.
View it using [Collision > View Simple Collision]
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:
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.
[File > Package Project]
[Build Configuration > Shipping]
Enable Full Rebuild through [Packaging Settings > Toggle Full Rebuild]
Back in [File > Package Project]
choose the [Windows platform > 64bit]
.
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.