Note: Because this is an ongoing series, viewers will not receive a certificate of completion.
Skill Level Intermediate
- [George] Hi, I'm George Maestri, If you want to add a little bit more realism to your scenes in Unity, you can always use reflections. Now, Unity has a couple of different ways to create reflections and today, I'm going to focus on screen space reflections, which are probably the simplest and easiest to set up. Now, we can set them up very simply just by turning them on. Now, you may already have them turned on, but if not, you can go into Edit, Project Settings, and under HDRP Default Settings, you want to make sure that you have Screen Space Reflections turned on. And you can kind of see what happens in this sphere as I turn them on. So, when I turn on Screen Space Reflections you're going to see a lot more reflectivity there. Now, screen space reflections are best for subtle reflections, such as a shiny floor, or something like that. So, let's go ahead and take this plane, which is in our scene and turn it into a shiny floor. So, if I scroll down, you'll see I have this blue material on it. And all I have to do is just dial up the smoothness and I will get some reflections. And one of the things about screen space reflections is that it's calculated only using those pixels, which are on the screen. Now, you can kind of see it here in this corner. So, you can see that these columns don't completely reflect. So, as this goes off the screen that reflection also goes off the screen. So, it's not a true reflection. Now, you can see it really clearly in this sphere. So, right now, I can see on the left and the right side of this sphere, I can see these columns. But if I go all the way around, you'll see that the columns behind me are not reflecting. So, this isn't a true 360 degree reflection. It's only giving you reflections from that which is on the screen. Now, we can control how these reflections work a little bit more specifically. Now, one of the things you'll notice is that if you select this plane and go down to that blue material you can dial down that smoothness, but you're going to hit a hard edge. Once you get below 0.9, they just instantly go away. And that's, basically, Unity's default settings for screen space reflection. Now, if you want a little bit more control, we can do that by adding a volume and giving it more control. So, I'm going to right-click here and go Volume, Global Volume, and that will affect everything in the scene. And so, now, what we have to do is we just have to add a profile to this. We're going to go ahead and create a new profile to this volume and add, what's called, an override. So, we're going to add in under Lighting, Screen Space Reflection and, now, this will give you complete control over how screen space reflections calculate within that global volume. So, I'm going to switch everything on. Now, the one problem we had with this ground plane is that we couldn't dial up below 0.9. And so, that minimum value is determined here by this minimum smoothness. So, if I dial this all the way down to maybe 0, or 0.1, you'll see I'm starting to get kind of more of a subtle reflection on that screen. And so, if I go back to that object here under Blue Material, I can now dial my smoothness up, or down to get the reflection a little bit more subtle. Now, if I re-elect my global volume I can also control a number of other things. One is the smoothness fade, so that's how that smoothness fades out. I can turn on or off reflections of the sky. Now, this one's really important, it's called Screen Edge Fade. And so, when it's at zero, and I position my camera, you can see that I'm getting a really hard edge here. And so, that's going to match the side of the screen. But I can turn this up to soften that edge, and so that it looks a little bit more naturalistic. Now, I can also change the quality of this from low, to medium, to high. And so, each one will add a little bit more calculations, slowdown the scene a little bit more. So, typically, we keep it on medium. So, one way to get reflections in Unity is to do screen space reflections. And if you want very precise control over those reflections, go ahead and add a global volume and put in a screen space reflection override.