|Please note that this is a BETA version of the document. All information presented is correct but we are working on improving the details.|
Planar reflection is a popular method to add realistic reflection to the floor or other flat surfaces. In this documentation, we will show you how you can add planar reflection to your scene.
How to add Planar reflection
We assume that you have already set up your scene and added the materials that you want to use. In this example, we will add a reflection to the floor but will talk about reflections that are not horizontal later.
Go to the shader of the floor model and change the shader to one that has _MIRROR in its name.
In this example, I am using PBR_Mirror_Norm_Light.xshad
Add a Transmit video and select MIRROR-1 in the From Tunnel property and connect its Out pin to the Mirror Image input of the shader:
go to the Root of the Flow editor and find Render_Gener/Render_General_PBR.
right click and select Unlink Compound
You can read more on linked compounds here.
The following nodes represent the planar reflection.
As you can see it has a Mirror Camera which means the scene is rendered again from a mirrored camera's perspective and its output is fed into the MIRROR-1 tunnel mentioned earlier.
There are other important nodes here, we will talk about them later in this documentation.
Placing the Planar Reflection
To get correct results you should position the Clip Plane of the Planar Reflection to be at the same height as the floor.
To do this you should select the Clip Plane node and move it to be at the same height as the floor.
- Using the Transformation Gizmo can help with this.
This example shows a correctly placed Clip Plane:
Note that the flickerin effect is called Z-fighting, which occurs when two planes are at the same position, this will not be visible in the reflection.
Adding more reflections
To add more reflection go into the Render_General/Render_General_PBR module and find the nodes mentioned earlier:
Select all of them and while pressing ALT Drag-n-Drop them, this will duplicate these nodes while keeping the connections.
Rename the Mirror-1-2 tunnel to something else in the Into Tunnel property, I've renamed it to Mirror-2:
Go to the model onto which you wish to add the second reflection and do the same steps mentioned earlier in How to add Planar reflection.
Note that this time you will need to select MIRROR-2 in the From Tunnel property when adding a Transmit video node.
Pay attention to also moving the clip plane to the correct position
You can add as many reflections as you like but these reflections are performance-heavy. you should always keep this in mind.
Optimizing the reflections
If you add a Planar Reflection to your scene it may not look how you want it or may cause your pc to overload.
By default, Planar Reflections are rendered in half of the resolution of the original render, it is done by dividing the actual frame size:
You can increase(lower B value) or decrease(higher B value) the size of the rendered image here.
We suggest no to go over half resolution of the original render as this would require much more performance and will not give much better visual results.
Blurrer/Mirror Image Filter
By default, mirror camera images are blurred. In the case of Render_General we are using a Blurrer node and with Render_General_PBR we are using a Mirror Image Filter.
These nodes can be changed to suit your preference more.
Both methods have their advantages:
- Blurrer can give slightly nicer results and a bit more performance efficient and you have more control over how blurry the image will be.
- Mirror Image Filter utilizes depth-based blur and uses the material roughness to calculate how blurred the image will be.
Visual artifacts and how to solve them
When working with Planar Reflections you might run into flickerings like this:
There are plenty of ways you can work on this to be less noticeable or even completely gone. We will go through each option going from the less costly.
Blurrer node has a Quality setting, we suggest trying to increase this setting first to a higher quality. Usually Medium is sufficient.
Mirror Camera Antialiasing
The Mirror Camera has an Antialis property that reduces the aliasing artifact of the rendered image. By default, this is set to 0.
You can try to increase this value. We suggest not going over 4x(unless that's absolutely necessary) as that would require much more performance and won't give much better results.
Increasing the Mirror Camera Resolution
As mentioned earlier the Planar Reflection is rendered in reduced resolution to save some GPU time, This is done via the Divide 1 node.
If you find that neither increasing the Blurrer quality nor increasing the Antialis setting or their combination doesn't give good enough results you can try to increase the resolution of the rendered image.
To do this you should DECREASE the B property of the Divide 1 node.
We do not suggest setting a lower value than 1. This would increase the resolution and have a huge load on the GPU.
These settings can be used simultaneously as well to get the desired visual and performance results.
For example, you can increase the Blurrer Quality and decrease the Antialising while leaving the resolution unchanged.
Basically, you will need to play a little bit with these settings until you find the sweet spot.
Adding vertical reflections
You can use Planar Reflection on vertical surfaces as well there is however an important limitation.
As a billboard is a 2d image in a 3d space we only have information of the front of the talent. This will cause incorrect reflections:
To get around this you can either put the billboard/reflection in a position where the billboard will not be visible in the reflection.
Or you can blur the image to a point where the billboard is not recognizable.