Today we are going to talk about the VR Fundamentals in Unity
**Check out this great class in Pluralsight*Unity VR Fundamentals by MJ Johns. This article/notes are based on this online class.
Unity is probably one of the best VR building engine so far. Let’s talk about how to make some cool VR in Unity.
What’s Virtual Reality?
Virtual reality (VR) is an interactive computer-generated experience taking place within a simulated environment, that incorporates mainly auditory and visual, but also other types of sensory feedback like haptic. — Wikipedia
There are 2 different types of VR for consumers and developers.
- Mobile VR: 3 Degrees of freedom / Mobile (limitation)
- Room Scale VR: 6 Degrees of freedom / PC or Mac / Tracked Controllers with Tactile Feedback
There are 4 major devices for mobile VR.
- Google Cardboard
- Gear VR
- Merge VR
- Google Daydream
There are 2 main device for Room-Scale VR
- HTC Vive
- Oculus Rift
Setting your first VR project in Unity: (example: PC)
- Set up a new project in Unity
- Download SDK (depends on what you are going to build):
*Google VR SDK:
- Create some simple 3 D objects in the scene: Create > 3D Object > Plane & Cube
- Create a build: File > Build Settings > Platform ->PC > Switch Platform (Button)
3. PlayerSetting (Button)>Inspector > Check the “XR support” > Add the device you are using.
Basic Concept of VR scene:
- We need to create a plane / ground and walls / barriers to help players preventing motion sickness.
- It is really important that in VR environment, the players have their own awareness of their own bodies. For example: If we put a car and make it run through the player’s body (*Proprioception), it will arouse the strong emotion and create an illusion that the car is really hitting the player.
Proprioception is the sense of the relative position of one’s own parts of the body and strength of effort being employed in movement.It is sometimes described as the “sixth sense”. — Wikipedia
Start to Create a VR scene:
- Create a new Scene.
- Insert.FBX or.OBJ in your scene. *Create a 3D capsule as a reference as the size of a real player — get a sense of the size of the real world and scale the 3D objects accordingly. *An Unity Cube equals 1 meter in real world.
- Apply Materials to your objects.
- Apply Colliders (box, sphere, capsule, or mesh collider ) to your static objects such as a wall, floors, and anything that will not have any interaction in the scene.
- Create Prefabs folder and make those prefabs by dragging them to the prefabs folder (Now all the 3D models are prefabs)
- Setting up VR environment:
- Add wall & visual barriers scaling according to the real world
- Place interactive objects 2–3 meters away from the player starting point
7. Create UI: World-Space Canvas or 3D Text:
- 3D text: GameObject>3D Object> 3D Text: Will show up in the scene even though it is behind a 3D object.
- Word-Space Canvas: GameObject>UI>Text: By default, it will not integrate well in the scene in Editing Mode. However, no matter where you position it, the text will be shown in front of the camera (Screen Space Overlay). If you want to change the position, you can change the render mode to World Space.
8. Create a 360 background or video:
- Create an inside-out sphere and scale it very large
- Attach 360 image
9. Design audio for the VR experience
You can add “Audio Listener” to either Camera or Game Object. Or you can add “SteamVR Plugin > Camera Rig”
- Surround Sound
- Ambisonic Audio
Ambisonic: A full sphere of audio capture, creating a fully immersive sound space, particularly for use in 360 film.
10. Make sure all the interactive objects are within the reachable distance for the player.