Reader small image

You're reading from  XR Development with Unity

Product typeBook
Published inNov 2023
Reading LevelBeginner
PublisherPackt
ISBN-139781805128120
Edition1st Edition
Languages
Tools
Right arrow
Authors (2):
Anna Braun
Anna Braun
author image
Anna Braun

Anna Braun is a Unity expert, who is specialized in creating XR applications. At Deutsche Telekom, Anna has developed XR prototypes in Unity. One prototype enabled warehouse workers to find commodities more easily through the use of special location data and Augmented Reality. At Fraunhofer, Anna specialized in Hand-Tracking and worked on a VR education platform. Her master's degree in Extended Reality has a special focus on Eye Tracking, Deep Learning, and Computer Graphics. She is a published author in the tech space and regularly speaks at conferences hosted by academia or non-profits like the Mozilla Foundation. Anna co-founded a company that offers XR consulting and development.
Read more about Anna Braun

Raffael Rizzo
Raffael Rizzo
author image
Raffael Rizzo

Raffael Rizzo is a XR developer and Unity expert. During his work at Deutsche Telekom, he consulted companies on the use of digital twins and implemented augmented reality wayfinding solutions. At Fraunhofer IGD, Raffael worked on a VR education platform. He developed a VR training program for a soccer academy to test the children's reaction times. For the same academy, Raffael created an application that uses computer vision and machine learning to automatically evaluate ball juggling. His master's degree in Extended Reality encompasses Rendering, Computer Vision, Machine Learning, and 3D Visualization. Raffael co-founded a company specializing in XR consulting and development.
Read more about Raffael Rizzo

View More author details
Right arrow

Adding Sound and Visual Effects

Creating immersive XR experiences requires more than just importing 3D assets and scripting interactivity. For a truly natural and captivating experience, we need to integrate sound and visual effects. Imagine an AR monster hunt game. You’ve built the logic, but without sound and visual effects, the blend of real world and virtual reality feels off. Adding subtle monster sounds can provide direction and distance clues. Integrating a particle effect such as gray fog can enhance the spooky, mysterious atmosphere. By stimulating multiple senses and adapting these elements to a user’s movements, we can significantly enhance the overall immersion and user experience of the AR monster hunt game.

This chapter aims to enhance your XR design skills, targeting more user senses for natural, immersive experiences. We’ll delve into sound theory and particle behavior basics, making these physics concepts accessible to all. We will delve into...

Technical requirements

To fully engage with and benefit from the VR application development process outlined in this chapter, your hardware must meet certain technical specifications. If you followed the tutorial in Chapter 3 and your Unity setup remains the same, you can bypass this section.

To follow along with this book’s content and examples, ensure your computer system can accommodate Unity 2021.3 LTS or a more recent edition, with Android or Windows/Mac/Linux Build Support, depending on the nature of your VR headset and PC.

Understanding sound theory and Unity’s audio system

In the subsequent sections, we will delve into the fascinating physics of sound waves and explore how Unity’s robust audio system allows us to manipulate these properties with its diverse range of audio components. Our journey begins with an introduction to the fundamentals of sound, the nature of sound itself, and its defining features – frequency and amplitude.

What are frequency and amplitude?

Sound, in essence, is a form of mechanical energy that propagates as a wave through a medium – most commonly, air. Simply put, mechanical energy is energy associated with the motion of objects. When an object vibrates, it displaces the surrounding air particles, setting off a chain reaction of particle displacement that travels outward in the form of a sound wave.

The two main parameters describing a sound wave are frequency and amplitude.

Frequency is the number of complete wave cycles per second,...

Preparing the VR drum scene and adding sound effects

After exploring the physical properties of sound waves and Unity’s audio system, you will finally put this theoretical knowledge into use by building your own VR drum scene.

Once you’ve created a VR scene featuring various drums, which can be struck by a player equipped with VR drumsticks in each hand, you’ll discover how to augment your setup by assigning distinct sound files to each drum that gets hit. Moreover, you’ll learn how to adjust the sound volume based on the intensity of the strike delivered by the VR drumsticks, adding an extra layer of realism. This refined VR drumming environment will plunge users into an impressively accurate and engaging drumming experience. Let us now set up and prepare our VR drum scene.

Setting up and preparing your VR drum scene

The following steps guide you on how to create your project, set up the needed VR settings in the Unity Editor, and add a player...

Understanding particle behavior and Unity’s particle system

When designing immersive XR experiences, understanding the physics of particle behavior plays an important role. By leveraging Unity’s particle system and the fundamentals of particle physics, you can create rich, dynamic, and realistic effects that enhance the immersion of your virtual environments. In this section, you will learn everything you need to know about real-world particle behavior.

Understanding the behavior of particles in the real world

Particle behavior in the physical world refers to the ways in which small fragments or quantities of matter move and interact, based on forces, environmental conditions, and intrinsic properties. Particles in the natural environment behave according to certain laws and principles. Key factors include gravity, air resistance, life span, and collision behavior. Here is an overview of what all these terminologies mean:

  • Gravitational forces: Particles...

Adding particles to VR scenes with varying properties

Do you recall the last time you attended a live concert when, at the pinnacle of a legendary song, the stage was enveloped by a blanket of white fog while you were lost in the music with your friends? Taking inspiration from the theatrical smoke often utilized in real-world concerts, we’re going to apply our recently acquired knowledge about Unity’s Particle System to create a similar effect. Our objective is to integrate a particle system into our drum scene to release fog every time a drum is hit, with the intensity of the fog corresponding to the velocity of the strike. The more frequently the drums are played, the more the fog should saturate our scene, and vice versa, thereby fully replicating the euphoric sensation of being at a genuine concert.

To achieve this objective, we need to first initialize a Particle System in our scene.

Initializing a Particle System in your VR drum scene

Follow these steps...

Summary

In this chapter, we embarked on a fascinating journey through the world of sound and particles, understanding their physical properties and delving into the implementation of these real-world phenomena in Unity scenes for heightened immersive experiences in XR.

Upon reaching the end of this chapter, you should now be capable of not only constructing end-to-end XR applications with intricate interactions or animations but also feel comfortable enhancing these creations, by effectively using Unity’s audio and Particle Systems to introduce an additional layer of realism to your XR scenes.

The XR development concepts we’ve covered so far in this book have largely been aimed at those at the beginner to intermediate levels. However, as we move forward, we have something truly unique and enriching in store for you. The following chapter will further elevate your XR development skills by introducing you to some of the most significant and advanced techniques in...

lock icon
The rest of the chapter is locked
You have been reading a chapter from
XR Development with Unity
Published in: Nov 2023Publisher: PacktISBN-13: 9781805128120
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.
undefined
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 £13.99/month. Cancel anytime

Authors (2)

author image
Anna Braun

Anna Braun is a Unity expert, who is specialized in creating XR applications. At Deutsche Telekom, Anna has developed XR prototypes in Unity. One prototype enabled warehouse workers to find commodities more easily through the use of special location data and Augmented Reality. At Fraunhofer, Anna specialized in Hand-Tracking and worked on a VR education platform. Her master's degree in Extended Reality has a special focus on Eye Tracking, Deep Learning, and Computer Graphics. She is a published author in the tech space and regularly speaks at conferences hosted by academia or non-profits like the Mozilla Foundation. Anna co-founded a company that offers XR consulting and development.
Read more about Anna Braun

author image
Raffael Rizzo

Raffael Rizzo is a XR developer and Unity expert. During his work at Deutsche Telekom, he consulted companies on the use of digital twins and implemented augmented reality wayfinding solutions. At Fraunhofer IGD, Raffael worked on a VR education platform. He developed a VR training program for a soccer academy to test the children's reaction times. For the same academy, Raffael created an application that uses computer vision and machine learning to automatically evaluate ball juggling. His master's degree in Extended Reality encompasses Rendering, Computer Vision, Machine Learning, and 3D Visualization. Raffael co-founded a company specializing in XR consulting and development.
Read more about Raffael Rizzo