Reader small image

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

Product typeBook
Published inNov 2023
Reading LevelBeginner
PublisherPackt
ISBN-139781804619537
Edition1st Edition
Languages
Tools
Right arrow
Author (1)
Steven Antonio Christian
Steven Antonio Christian
author image
Steven Antonio Christian

Steven Christian is an Augmented Reality Developer, Animator, and Medical Student Student. He's also the Owner of Iltopia Studios where he creates comics and cartoons that explore the Black experience in America. He is Unity Certified 3D Artist and Instructor and his goal is to improve equity in arts and technology through content creation and community-focused education.
Read more about Steven Antonio Christian

Right arrow

Adding indoor lights

As I mentioned in the lighting chapter (Chapter 6), setting up our lights is crucial to increase visibility; but more importantly, if you don’t set up your lights correctly, you will run into performance issues. We will cover more on how to improve performance by baking our lights in Chapter 18, which covers optimizations. But for now, our focus is on setting up our lights in a way that makes sense for the art gallery and creating a system to control the lights based on proximity.

Note

Overuse of dynamic lights can hinder performance, particularly in VR. Implementing baked lighting for static items is advisable to enhance performance.

To set up indoor lighting with spotlight prefabs (Figure 12.3), follow these steps:

  1. Create a new, empty GO as a child of ArtGallery.
  2. Name it CeilingLights.
  3. From our prefabs folder, add a CeilingLight prefab as a child of the CeilingLights GO.
  4. Set the X position to 0.09.
  5. Set the Y position to...

Adding light switches

We can provide a workaround to have high-quality lights and great performance while also limiting the number of lights that are turned on within a certain proximity. We can do that by creating a system where we press a light switch, and in doing so, turn off the lights that are within a specified distance of that light switch. Therefore, we’re able to simulate a somewhat realistic experience of only having lights on that are turned on by us and turning off the lights that are not.

To create a light switch to place on the walls, go through the following steps:

  1. Create an empty GO as a child of ArtGallery.
  2. Name it LightSwitches.
  3. Create another empty GO in LightSwitches.
  4. Name it LightSwitch.
  5. Create a cube as a child of the LightSwitch GO.
  6. Name it SwitchBody.
  7. Set the Y position to .05. Set the X scale to .5. Set the Y scale to .1. Set the Z scale to .5.
  8. Give the cube a DarkGray_Standard material.
  9. Create a cylinder and...

Creating a drawing system

In this section, we’ll be focusing on creating a drawing system that incorporates two core components: a canvas that can be drawn on and a marker that can be used for drawing. These two objects work together to create the drawing experience. Individually, they are just objects that you can interact with. You can expand on this system by modifying the canvas to cover a larger area, allowing you to draw on a larger surface instead of the predefined size we initially create.

To create a drawing canvas (Figure 12.7), go through the following steps:

  1. Create a new plane.
  2. Name it Whiteboard.
  3. Set the X position to 3.6, the Y position to 2.4, and the Z position to -0.4.
  4. Set the X rotation to 90, the Y rotation to 90, and the Z rotation to 90.
  5. Set the X scale to 0.3, leave the Y scale at 1, and set the Z scale to 0.3.
  6. Create a new C# script, name it WhiteboardController, and add it to the Whiteboard GO.
  7. Add the following namespace...

Hanging a picture frame

When you think about art galleries in general, you might wonder whether there’s any point in having one if you can’t hang things on the walls. Say you spent all this time working on a piece of art and you don’t know what to do with it. You could take your art to the hypothetical art gallery and hang it on the art gallery wall so that people who visit the virtual gallery can see it. In many ways, you can have a virtual space that you have full control over to display your art. Even if you haven’t set up the locations on the wall where you are going to place the art, you can set up sockets and places for you to place your art.

In this section, we’ll proceed to make a picture frame that can hold art in it. We will be able to place it on our wall so that we can display the art in the frame. To do this, we will be utilizing sockets, which you should be familiar with from the introduction to all of the XR interactable components...

Summary

In this chapter, we had a good mix of applying creativity and technical skills. Our goal, as outlined in Chapter 10, in Phase 6 of our roadmap, was to create an art gallery experience. We began by designing a floor map and then creating a 3D model of it. We added lights and created a system to control them procedurally and automatically. After that, we built a drawing system that included a canvas and markers with customizable settings. Finally, we created a hanging system that allowed us to place picture frames on walls with socket indicators. These implementations utilized familiar concepts and were intuitive, allowing us to create various types of experiences.

In a later chapter, we will explore how to create a theater experience where users can watch a movie on the big screen. By tapping into familiar concepts, we can create memorable experiences that are novel in their presentation. The key is to add our own twist and set ourselves apart by applying these concepts in...

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 2023Publisher: PacktISBN-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.
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 €14.99/month. Cancel anytime

Author (1)

author image
Steven Antonio Christian

Steven Christian is an Augmented Reality Developer, Animator, and Medical Student Student. He's also the Owner of Iltopia Studios where he creates comics and cartoons that explore the Black experience in America. He is Unity Certified 3D Artist and Instructor and his goal is to improve equity in arts and technology through content creation and community-focused education.
Read more about Steven Antonio Christian