How to create a realistic mirror?

Hello. After 2 days of searching, I still have no idea how to create a realistic mirror. I tried ‘Scene Capture 2D’, setting ‘metallic’ to 1 and ‘roughness’ to 0, and using blueprint. Everything looks ugly :frowning: there must be a way to do it… (i think so). Can you help me?

Sorry for errors, english is not my native language :stuck_out_tongue:

@anonymous_user_fb796d6c

Now there is just one problem. I don’t see myself in mirror.

Use planar reflection capture.

OK, I made a glass material with this tutorial: Unreal Engine 4 Tutorial: Glass Material (english) - YouTube
but when i place it on a box, it disappears…
In editor it looks like this:

In game it looks like this:

and have collision turned off.

What am I doing wrong?

Try adding a reflection capture actor to your scene, close to the glass.

As others have mentioned, you need a reflection capture actor when using glass materials. Place it in your scene and build the lighting, then see how it looks. =)

Hi Chydzim,

So first off, do you want a mirror or glass with a reflection? because even though they may seem very similar, they’re very different in how they’re setup. A mirror material is somewhat easy, but it requires a few things to setup.

First you need to make your material, which should look like this:

To explain how this works, is somewhat simple, there’s 3 parts to this material:

Base Color : this needs to be white if you want it to act like a silvered mirror, rather than a very reflective differently colored object. If you want to see what I mean, just change this color.

Metallic: this is a value that can be between 0 and 1, which determines how much like a metal this material looks like. We want to set this to 1 so that it looks completely like a metal. The reason for this is because a mirror in real life is actually a pane of glass with silver layered over one side of it, so the reflective qualities of silver (the metal) are what make a mirror look the way it does.

Roughness: this value can be all over the place, but we usually want to keep it between 0 and 1. To try and explain roughness completely could take a lot of time, but what it really means is just how “rough” the surface of the material is. Something that is very rough has a lot of different tiny planes on it in real life, which cause light to be reflected in all sorts of different directions which causes the light to ‘diffuse’ which is why we call materials like this a ‘diffuse’ material; they aren’t very reflective and can appear flat. Metals are the opposite of this, as they have very organized surfaces (so they have very low roughness) that direct light in mostly the same direction which is a 45 degree angle from where it hits the surface (called the angle of incidence sometimes). So to make something that is like a well polished and reflective metal, we want a roughness near 0. No real life object would have a roughness of 0 but very small ones like 0.001, but we can just set it to 0 here. So by setting roughness to a 0 constant, we get a very reflective surface.

Now if you try and put this material on an object and toss it in your world, it won’t do reflections properly. This is because in video games it would be very costly to try and do reflections by ray-tracing. So instead we use what are called “Reflection Capture” elements. A “Reflection Capture” element is something that captures an image of the screen so that you can use it in your reflections, and allows the game to run much smoother while still using reflections in real time. Unreal Engine 4 has a very simple Reflection Capture system though!

All you have to do, is place a “Reflection Capture”(Not “Scene Capture”!) actor in your world - which if you try to search in the assets you’ll find two that come up (picture below)


Now you’ll notice there are two: one is a cube and one is a sphere. A sphere will capture reflections as if it was a spherical object, and a cube will do it like a flat-faced cube. Each one has different pros and cons that I won’t get into, but just use a Reflection Capture Cube right now. All you have to do to use them is place one in your world where you want the reflection to be being captured from, so in your case it should be inside of your mirror or just at the front of it. Beware though, you don’t want a lot of reflection capture actors because that will make your game grind to a halt in terms of how slow it will be!

Now once you have placed a Rection capture actor in your world, your mirror material should be reflecting properly and you’re all set!

Now, if you wanted a glass material with reflective capabilities, then the shader will need to be different. Make sure you still have a Reflection Capture actor in your map (you will still need it for the glass to have a reflection). Then you need to create a new material. Make sure the material domain is set to Surface, and the Blend mode to Translucent. You may notice this grays out some of the plugs we used before, such as Metallic, but opens up other ones you need for glass such as “Opacity”. Well to fix that we need to change the translucency Lighting Mode which can be found under “Translucency” in the shader menu when the output material is selected. This needs to be set to a type that accounts for the surface of the material instead of the volume of the material, so try setting it to “Surface Translucency Volume”. Here’s a picture:

Now all the nodes you need will ungrey. Just recreate the material I’ve shown above. It has two constants:

Opacity: This is how transparent the material is, and this needs to be low but still a value above 0. It can’t be 0 otherwise you won’t see any reflections, but the closer to 1 it becomes the more opaque your material will get.
Roughness: Just like before, we need a roughness of 0. Glass isn’t a metal though and metals aren’t (normally) transparent, so you don’t want to plug anything into the metallic node.

Now once you apply this material, go try and look at it in the world. There should be the faint reflection of the world around it in this mostly-transparent glass!

I hope that helps clear things up for you!

4 Likes

I added it. Now it looks like this:

(I made new blueprint with DanielW’s instruction, works better)

I see I have also problem with a light build. I have to rebuild it even if I have built it 3 seconds ago, and FPS drop in editor (about 15 FPS) when looking on a planar reflection.

I think this version of engine is kinda buggy.

@anonymous_user_fb796d6c

I haven’t seen your posts before, I will say if it works :slight_smile:

@edit2

I did everything same as shade599 said and it’s not working.

BTW. I thought that “Scene Capture” is not needed if we don’t make a material with it and place it on object, am I right?

Oops! I made a mistake, sorry.

You’re right that Scene Capture is for capturing things and putting them on a specific material, much like you would if you are creating a video screen hooked up to a camera. What you should be putting in your level is a Reflection Capture!

Try that and see if it works?

Edit: I changed my initial post, fixing my mistake. Tell me if that works for you now?

And I can’t see myself in this mirror. I still have error with light.

@anonymous_user_fb796d6c

Light rebuild is taking about one 2 minutes, but I have now 0 lights on level. Even if I deleted all lights, error still appears.

@edit2

SwarmAgent logs:
deleted

@edit3

OK, mirror is working! But i don’t see myself in it, how to fix it?

And I still have problem with light rebuild.

@refresh

I think I fixed light problem. But I still don’t see myself in this mirror :frowning:

Do you have plane reflection actor in place?

No, if I place it, mirror is not working.

You won’t get mirror without it. Go to rendering settings and check that you have “use global clipping plane” activated.

Yes, “Support global clip plane for Planar Reflections” is activated.

I placed planar reflection, it’s working. But I still don’t see myself in it.

First person game? Do you actually have player mesh in scene?

Yes, I can see it when I look down.

In the first person game the player has only a gun and arms

Yes, but I have my own mesh and it’s full.

@ r e f r e s h