This is an old revision of the document!
### PIDI Planar Reflections 2 is an advanced tool to add real-time reflections to your 3D scenes easily and with a low performance impact. The tool comes with dozens of custom shaders that allow you to create all kinds of reflective surfaces from simple mirrors and basic opaque surfaces to complex PBR materials, water and glass floors and walls. ###
### Furthermore, the asset comes with specific shaders and workflows for mobile devices and the new Lightweight SRP renderer, starting with version 5.7 for Unity 2019.1. In this documentation you will find a general description of all the different features of this asset, a small setup guide and some performance tips to help you add reflections to your scenes in no time. ###
### Due to the many limitations in SRP rendering including the inability to render cameras manually, render with custom shaders/effects, the limited access to the rendering process on a per-camera basis and many others, reflections in LWRP are severely limited. In essence, LWRP reflections can use only the basic features of this asset but for a full feature comparison you can see the table below. ###
Feature | Lightweight SRP | Standard Rendering |
---|---|---|
Non-Mesh reflectors | X | ✓ |
Reflection to Render Texture Asset | ✓ | ✓ |
Dynamic reflection resolution | X | ✓ |
Layer-specific reflections | ✓ | ✓ |
Advanced optimization | X | ✓ |
Advanced rendering control | X | ✓ |
Water shader | X | ✓ |
Depth based effects | X | ✓ |
### While a LWRP package for older Unity releases (pre 2019.1) is provided, this package is no longer supported nor is recommended to use in any projects. ###
### Two newer packages are provided to support the actual LWRP releases, one for LWRP 5.7 on Unity 2019.1 and one for LWRP 6-9 on Unity 2019.2. These packages are clearly labeled as such and easy to install, just by unpacking their contents inside the Unity Editor after double clicking on either one. ###
###
The LWRP capabilities of this asset are then limited to Unity 2019.1 and 2019.2. For future Unity releases and LWRP versions you may want to consider upgrading to PIDI Planar Reflections 3
###
### In this quick guide we will go through the whole process of using PIDI Planar Reflections 2, from installing the software into your project to adding it to a scene. ### ### As a first step, please ensure that your project fully meets the requirements below : ###
### While PIDI : Planar Reflections 2 has been designed to be integrated to any project at any stage of development with little to no setup required, there are still some considerations to be made for projects which are upgrading from the original release (version 1.0 - 1.9 ) or projects using the new Lightweight Rendering Pipeline (LWRP). Below you will find the steps to follow in order to install and setup PIDI : 2D Reflections 2 in any of these cases. ###
###
For projects working with the Standard Pipeline there is little to no setup required. If this is a first time installation you just need to head to the Asset Store and find this asset either under the section “My Assets” or by a normal search in the store itself.
###
###
If you have bought the asset, a Download / Import / Update button will show, depending on if you have never downloaded the asset before, you have downloaded it and it is in cache already or there is a new version available for download, respectively.
###
###
Once the import dialog appears, just import all the contents of the asset as usual. To verify that the asset was imported without any errors try to open one of the demo scenes. If they work without issues, the package has been imported correctly. If you see any graphical errors you must re-import the asset. If the issues persist even with a brand new and empty project, please contact us at our support email
###
###
In the last step described above, once you see the import dialog while adding this asset to your project, DO NOT import the Standard Pipeline folder to your project. Importing this folder would cause errors due to the shaders and materials included in it being incompatible with LWRP.
###
###
Instead, once the tool has been fully imported, unpack LWRP 5.7.unitypackage (which is located inside the LWRP Contents folder) into the project or the LWRP 6.9.unitypackage file if you are working on Unity 2019.2 and import its contents. This will add all the necessary shaders, demo scenes and additional files for you to start using PIDI Planar Reflections 2 in Unity 2019.1+ with LWRP 5.7+
###
### While we do our best to keep up to date with LWRP releases there may be times when Unity updates their pipelines and adds or removes functionality from them (and in most cases breaking the compatibility of LWRP shaders) before we can issue the corresponding update. If your version of LWRP does not load the shaders appropriately or the demo scenes inside the LWRP Add on folder show pink materials please be patient, as we will issue the corresponding patch usually within 1-2 days of a new LWRP release or contact us to let us know the details of the error to our support email. ###
### Warning : Please remember to make a backup of your project before upgrading or installing any tool or asset. While we do our best to ensure that our software is free of errors and easy to use, we are not responsible for any loss of data, corrupted files or projects produced during the installation or use of this software. ###
### Once the asset has been successfully installed into your project, adding reflections to an existing scene is a simple process that can be done in just a few minutes. For more advanced uses and in-depth information about each feature please continue reading this documentation. ###
### There are several ways to add dynamic, real-time reflections to your scene with our plugin. Which one you should use depends a lot on the kind of project you are developing and its target devices. In this section we will describe the basic and general approaches you can use for your projects. ###
### The easiest (and most common) way of adding dynamic planar reflections to your scene is to simply add the PIDI_PlanarReflection component to a GameObject that has a MeshRenderer component and a compatible material (a material with a ReflectionTex property). ###
### The PIDI_PlanarReflection component will automatically try to use the forward direction of the object as the normal from which the reflections will be calculated. This normal is simply put a straight vector perpendicular to the reflective surface. ###
### While this is useful for most flat objects such as floors and walls, sometimes this behavior is not optimal since the forward direction and the actual normal of the reflective surface may not match. In these cases, simply enable the EXPLICIT NORMAL setting and define the explicit normal direction (in world coordinates) that will be used to generate the reflections. Starting on version 1.7 you can enable the LOCAL NORMAL MODE flag so the explicit normal is calculated based on the object's local coordinates. This is useful if the reflective object will rotate during the game. ###
### In some cases, such as a house with floors of different materials but all in the same plane, you may want to render a reflection that can be shared across all of them. In other cases a single mesh may contain more than one reflective material, making it impossible to add the PIDI_PlanarReflection component directly. ###
### For these situations the right solution is to create a Planar Reflector Object. These objects render reflections to a custom RenderTexture asset which can then be assigned by hand to any number of materials. Furthermore, these reflector objects are only visible in the Scene View which makes them ideal for complex scenes and a more precise control over the reflections. ###
### To create a Reflector Object, go to the “GameObject/PIDIFramework/Environment” menu on the Unity's Editor top toolbar, and select Planar Reflector. ###
### Once the Reflector is created, simply assign the RenderTexture asset into the Explicit Output variable of the Rendering Settings tab and it will immediately start rendering an accurate reflection. ###
### IMPORTANT : The Reflector Objects are not compatible with the LWRP workflow and generally are not as flexible as having one reflection component per surface. Please use carefully. ###
### While the Planar Reflections component provides plenty of settings that will be more thoroughly covered in the next sections of this documentation, there are some basic ones that you need to pay special attention to in order to configure basic and efficient reflections. ###
### Besides the EXPLICIT NORMAL value covered before, the REFLECT LAYERS setting can define which layers are reflected and which ones ignored, to ensure a better performance. ###
### Finally, the different resolution settings allow you to control the final quality of the rendered reflection. A higher resolution might help to reduce aliasing in cases where MSAA or FXAA cannot be used, while a lower resolution will greatly help with performance when rendering scenes that use complex per-pixel effects. ###
### Please keep in mind that due to the way Planar Reflections work (by basically re-drawing all the reflected objects for each camera that looks at the reflection) the best way to optimize the framerate of your project is to reduce the total amount of draw calls either by simplifying the scene or by reducing the amount of objects that are reflected. Reducing the resolution of the reflection, its update frequency and other factors will only help performance up to a point. ###
### The Planar Reflection Component has a custom inspector that allows you to easily manipulate its settings and configure it according to your needs. The parameters are split in three groups : General Settings, Rendering Settings and Optimization Settings. ###
### In the General Settings section you can find the following settings : ###
### In the Rendering Settings tab you can find all the following settings : ###
### Finally, in the Optimization Settings section you can find the following settings : ###
### In this section of the documentation we will learn more about advanced features included with the system, as well as some features that while now deprecated and unsupported may be useful for some projects with specific needs. Any feature that is no longer supported, experimental or deprecated is marked as such. Please read carefully all instructions before trying to use any of the settings described below. ###
### If the shader used by the material of your reflective surface has a _ReflectionDepth parameter, the PIDI Planar Reflection component will render, besides the reflection pass, a depth pass containing information about the distance from every object to the reflective surface itself, allowing it to render more accurate reflections. ###
### The depth calculations of the reflections component are handled internally, without requiring you to do anything to enable them. You just need to make sure that the PIDI_PlanarReflection component has the included PD_Internal_DepthShader assigned to the corresponding DEPTH SHADER slot. To disable depth calculations simply change the shader to one without a _ReflectionDepth parameter. ###
### Reflection Depth is not supported on Planar Reflector objects since all their calculations are made in a per-surface basis and cannot be shared. The additional Reflection Depth pass also causes a higher performance impact, so use it carefully ###