Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Enhancing Virtual Reality Experiences with Unity 2022

You're reading from  Enhancing Virtual Reality Experiences with Unity 2022

Product type Book
Published in Nov 2023
Publisher Packt
ISBN-13 9781804619537
Pages 566 pages
Edition 1st Edition
Languages
Author (1):
Steven Antonio Christian Steven Antonio Christian
Profile icon Steven Antonio Christian

Table of Contents (25) Chapters

Preface 1. Part 1: Philosophy and Basics of Understanding Virtual Reality
2. Chapter 1: Philosophy of Building Immersive Experiences 3. Part 2: Technical Skills for Building VR Experiences in Unity (Assets, GameObjects, Scripts, and Components)
4. Chapter 2: Building VR Scenes in Unity 5. Chapter 3: Working with Inputs and Interactions 6. Chapter 4: Using Game Objects, Materials, and Prefabs 7. Chapter 5: Implementing Animation – Physics and Colliders 8. Chapter 6: Lighting Your Worlds and Experiences 9. Chapter 7: Creating Immersion with Sound 10. Chapter 8: Working with C#, Unity Events, and Input Actions 11. Chapter 9: Unlocking the Power of Render Pipelines 12. Part 3: Projects: Putting Skills Together
13. Chapter 10: Design Thinking for Virtual Reality Experiences 14. Chapter 11: Adding Audio to a Virtual Reality World 15. Chapter 12: Building an Art Gallery 16. Chapter 13: Animating a Virtual Reality Experience 17. Chapter 14: Recording Virtual Reality Videos 18. Chapter 15: Enhancing Virtual Reality Rigs 19. Chapter 16: Triggering Actions in Virtual Reality 20. Chapter 17: Destroying Objects in Virtual Reality 21. Part 4: Final Touches
22. Chapter 18: Optimizing Your Virtual Reality Experiences 23. Index 24. Other Books You May Enjoy

Lighting Your Worlds and Experiences

Lighting plays a critical role in VR development and has the power to make or break the overall experience of an application. The right lighting system can help to create an immersive and believable environment that is engaging and enjoyable for users.

In this chapter of our book, we will be diving into the intricacies of the lighting system in Unity. As you progress through the chapter, you will learn about all the essential components of the lighting system, including directional lights, spot lights, point lights, and area lights. These components play a crucial role in creating dynamic and realistic lighting in your VR environment.

Additionally, we will also be discussing the use of skybox materials and emissive materials, which are essential in creating a believable and immersive environment. Another important aspect of lighting in Unity is light baking, which is the process of pre-computing lighting information to improve performance...

Getting to know the Unity lighting system

Unity’s lighting system is a powerful tool for creating realistic and immersive environments in games and other interactive experiences. The lighting system is based on physically based rendering (PBR), allowing Unity to simulate the physical properties of light and how it interacts with objects in the real world. It allows developers to control the way light interacts with objects in their scenes and create complex lighting effects such as shadows, reflections, and ambient occlusion to provide more realistic and believable lighting effects in their VR experiences. Let’s have a look at this in a bit more detail, as follows:

  • Shadows: The effect in Unity’s lighting system that simulates the way light is blocked by objects in a scene, creating areas of darkness. This can greatly enhance the realism of lighting in a VR environment.
  • Reflections: The ability of Unity’s lighting system to simulate the way light...

Simulating indoor lighting

In this section, we will be focusing on simulating indoor lighting using the lighting system. We will start by removing the main plane and keeping the simple skybox. Next, we will add the demo room and VR rig back into the scene. We will then replace the emissive materials with regular standard materials and set up the lighting for the indoor demo room. Finally, we will create a high-quality skybox material to enhance the overall look and feel of the indoor lighting.

Before we begin, create a new scene called 06_03_IndoorLighting.

To set up our indoor lighting scene, go through the following steps:

  1. Go to our Prefabs folder in the Project tab.
  2. Add a DemoRoom prefab.
  3. Add a VR Rig prefab.
  4. Remove the Main Camera.
  5. Add an Event System GO.
  6. In the Event System GO, select Replace with InputSystemUIInputModule.
  7. Create a DarkGrey_Standard material for the walls.
  8. Create a LightGrey_Standard material for the ground.
  9. Apply...

Modifying quality settings for lighting

Before we move to emissive materials, you may have noticed that there is a limit to how many active lights there are.

To change the quality settings to improve the light count, go through the following steps:

  1. Navigate to the Project Settings tab.
  2. Select Quality Settings.
  3. Change Quality to Medium.
  4. Set Pixel Light Count to 10 (Figure 6.13). Be aware that increasing the pixel light count can negatively impact the performance of low-end devices, so monitor their performance and adjust the pixel light count as necessary to achieve a balance between visual quality and performance.
Figure 6.13 – Quality settings for optimizing the amount of available lights rendered in our demo scene

Figure 6.13 – Quality settings for optimizing the amount of available lights rendered in our demo scene

Figure 6.14 – Optimizing rendered lights in our demo scene: before (top) and after (bottom)

Figure 6.14 – Optimizing rendered lights in our demo scene: before (top) and after (bottom)

We can now give our lightbulbs a glow with emissive materials.

Emissive materials...

Introducing post-processing

Post-processing in Unity refers to a set of techniques and effects that can be applied to a scene after the main rendering has been completed. This can include effects such as color correction, bloom, depth of field, and many others. Key features of post-processing in Unity include the following:

  • A wide range of effects: Unity provides a large number of post-processing effects that can be applied to a scene, ranging from simple color correction to more complex effects such as bloom, depth of field, and motion blur
  • Customizability: Each post-processing effect in Unity can be customized and adjusted to suit the specific needs of a project, allowing developers to fine-tune the look of their VR environments
  • Easy to use: Post-processing effects in Unity can be easily applied to a scene using the Unity post-processing stack, which is a set of tools and scripts that simplify the process of adding post-processing effects to a scene

Post-processing...

Summary

This chapter has provided an in-depth exploration of the lighting system in Unity and its various components. From directional lights, spot lights, point lights, and area lights, to skybox materials, emissive materials, light baking, post-processing effects, and local and global volumes, this chapter covers all the essential elements of lighting in Unity. Now that you are at the end of this chapter, you will have a solid understanding of how to use lighting and post-processing to create dynamic and realistic VR environments. Whether you are just starting out or are an experienced Unity developer, this chapter will give you the knowledge and skills you need to take your VR development to the next level. In the next chapter, we will explore audio and sound effects.

lock icon The rest of the chapter is locked
You have been reading a chapter from
Enhancing Virtual Reality Experiences with Unity 2022
Published in: Nov 2023 Publisher: Packt ISBN-13: 9781804619537
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime}