This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
pidi_2d_reflections_2 [2020/08/25 01:44] irrsoft [Installation and upgrade] |
pidi_2d_reflections_2 [2021/01/17 03:49] irrsoft [Universal RP Add on Limitations] |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== PIDI 2D Reflections 2 ====== | ====== PIDI 2D Reflections 2 ====== | ||
<WRAP justify> | <WRAP justify> | ||
- | PIDI 2D Reflections 2 is the most efficient and complete solution to add real-time reflections to your 2D games in Unity. | + | PIDI 2D Reflections 2 is the most efficient and complete solution to add real-time reflections to your 2D games in Unity |
</ | </ | ||
<WRAP justify> | <WRAP justify> | ||
- | A full redesign of the original release, packed with impressive new features, amazing performance and an easy workflow as well as support for many high end effects such as masking, fading, Post Process Stack v2, LWRP and more, PIDI 2D Reflections 2 is the only tool you need for all your 2D reflection needs. | + | A full redesign of the original release, packed with impressive new features, amazing performance and an easy workflow as well as support for many high end effects such as masking, fading, Post Process Stack v2, Universal RP and more, PIDI 2D Reflections 2 is the only tool you need for all your 2D reflection needs. |
</ | </ | ||
\\ | \\ | ||
Line 12: | Line 12: | ||
</ | </ | ||
<WRAP justify> | <WRAP justify> | ||
- | Below you can see a comparison table showing the full feature set of each edition. The Lite edition has an additional module that adds LWRP support in Unity 2019.1+ (this module is included in the Standard edition). To learn more about the specific limits and differences between the standard Unity rendering pipeline (also known as Built-in) and the new LWRP pipeline, please go to the corresponding section of the documentation. | + | Below you can see a comparison table showing the full feature set of each edition. The Lite edition has an additional module that adds Universal RP support in Unity 2019.4+ (this module is included in the Standard edition). To learn more about the specific limits and differences between the standard Unity rendering pipeline (also known as Built-in) and the new Universal RP pipeline, please go to the corresponding section of the documentation. |
</ | </ | ||
Line 29: | Line 29: | ||
| Reflections on any direction | X | ✓ | | | Reflections on any direction | X | ✓ | | ||
| Mobile support | ✓ | ✓ | | | Mobile support | ✓ | ✓ | | ||
- | | LWRP Support (Unity 2019.1+) | Sold separately | + | | Universal RP Support (Unity 2019.4+) | Sold separately |
<WRAP justify> | <WRAP justify> | ||
Line 36: | Line 36: | ||
\\ | \\ | ||
- | ===== LWRP Add on Limitations ===== | + | ===== Universal RP Add on Limitations ===== |
<WRAP justify> | <WRAP justify> | ||
- | The Lightweight SRP is a new rendering pipeline | + | The Universal RP is a new rendering pipeline |
</ | </ | ||
<WRAP justify> | <WRAP justify> | ||
- | Because of its "in-development" | + | Due to regular changes |
</ | </ | ||
<WRAP justify> | <WRAP justify> | ||
- | Besides this, the Lightweight | + | Besides this, the Universal RP pipeline lacks several core features present in the Standard (Built-in) pipeline which has make it impossible to fully port all features of PIDI 2D Reflections 2 to Universal RP. Below you can find a small comparison detailing which features are available in Universal RP and which ones are absent or just partially implemented. |
</ | </ | ||
{{tablelayout? | {{tablelayout? | ||
- | ^ Feature | + | ^ Feature |
| Post Process Stack v2 support | ✓ | ✓ | | | Post Process Stack v2 support | ✓ | ✓ | | ||
| Parallax backgrounds support | X | ✓ | | | Parallax backgrounds support | X | ✓ | | ||
- | | Dynamic Reflection Resolution | | + | | Dynamic Reflection Resolution | |
- | | Masked reflections | | + | | Masked reflections | |
| Faded reflections | ✓ | ✓ | | | Faded reflections | ✓ | ✓ | | ||
| Ultra-optimized simple shader based reflection | X | ✓ | | | Ultra-optimized simple shader based reflection | X | ✓ | | ||
Line 60: | Line 60: | ||
| Support for skewed reflections | ✓ | ✓ | | | Support for skewed reflections | ✓ | ✓ | | ||
| Support for custom shaders | ✓ | ✓ | | | Support for custom shaders | ✓ | ✓ | | ||
- | | 2D Water shader example | | + | | 2D Water shader example | |
| Reflections on any direction | ✓ | ✓ | | | Reflections on any direction | ✓ | ✓ | | ||
- | | Mobile support | | + | | Mobile support | |
- | <WRAP justify> | ||
- | Notice : There are several differences and apparent issues when working with LWRP due to the unfinished nature of the pipeline. Many of the " | ||
- | </ | ||
- | |||
- | <WRAP justify> | ||
- | So far, these undesired behaviors include not being able to correctly preview reflections in the Scene View since the Scene View has not been fully integrated to LWRP yet and a slight delay in the way the reflections are rendered inside the Editor. This delay has also been observed when using very high quality settings in a build (high MSAA and VSync) in a few devices when using Unity 2019.1 but is not apparent in most configurations | ||
- | </ | ||
- | |||
- | <WRAP justify> | ||
- | Unfortunately, | ||
- | </ | ||
\\ | \\ | ||
---- | ---- | ||
Line 86: | Line 75: | ||
==== Installation and upgrade ==== | ==== Installation and upgrade ==== | ||
<WRAP justify> | <WRAP justify> | ||
- | While PIDI : 2D 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 | + | While PIDI : 2D 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 Universal |
</ | </ | ||
Line 110: | Line 99: | ||
</ | </ | ||
---- | ---- | ||
- | === LWRP Projects === | + | === Universal RP Projects === |
<WRAP justify> | <WRAP justify> | ||
- | If you are using the Full version or have purchased the LWRP Add-on for the Lite version you must follow additional steps before using this asset in a LWRP compatible project. | + | If you are using the Full version or have purchased the Universal RP Add-on for the Lite version you must follow additional steps before using this asset in a Universal RP compatible project. |
</ | </ | ||
<WRAP justify> | <WRAP justify> | ||
- | 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. | + | 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 Universal RP.</ |
- | ### | + | |
\\ | \\ | ||
- | {{ :fig0a_installation3.png? | + | {{ :reflections2d_universalrpinstall.jpg |}} |
\\ | \\ | ||
<WRAP justify> | <WRAP justify> | ||
- | Instead, once the tool has been fully imported, unpack | + | Instead, once the tool has been fully imported, unpack |
</ | </ | ||
<WRAP justify> | <WRAP justify> | ||
- | 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) | + | While we do our best to keep up to date with Universal RP releases there may be times when Unity updates their pipelines and adds or removes functionality from them before we can issue the corresponding update. If your version of Universal RP does not load the shaders appropriately or the demo scenes inside the Universal RP Add on folder show pink materials please be patient, as we will issue the corresponding patch usually within 1-2 days of a new Universal RP release or contact us to let us know the details of the error to our [[support@irreverent-software.com|support email]]. |
</ | </ | ||
\\ | \\ | ||
Line 171: | Line 159: | ||
==== Adding reflections to a sprite ==== | ==== Adding reflections to a sprite ==== | ||
- | ### | + | <WRAP justify> |
PIDI 2D Reflections 2 is designed to work in a fully two dimensional space. This means that the reflections will work in a single direction at a time and the actual reflective surface has to be assigned to one of the edges of the sprite. | PIDI 2D Reflections 2 is designed to work in a fully two dimensional space. This means that the reflections will work in a single direction at a time and the actual reflective surface has to be assigned to one of the edges of the sprite. | ||
- | ### | + | </ |
{{ : | {{ : | ||
- | ### | + | <WRAP justify> |
To make this process as simple as possible, the tool by default reflects objects in a Y- (upwards) direction from the origin of the sprite. This means that, to get the best results, the origin of the object must be located on the upper edge of the object. | To make this process as simple as possible, the tool by default reflects objects in a Y- (upwards) direction from the origin of the sprite. This means that, to get the best results, the origin of the object must be located on the upper edge of the object. | ||
- | ### | + | </ |
- | ### | + | <WRAP justify> |
Do not try to match the origin of the object to the actual " | Do not try to match the origin of the object to the actual " | ||
- | ### | + | </ |
- | ### | + | <WRAP justify> |
To adjust the reflection' | To adjust the reflection' | ||
- | ### | + | </ |
\\ | \\ | ||
- | ### | + | <WRAP justify> |
Once the sprite is ready, simply add the PIDI_2DReflections component to it and ensure that your Sprite Renderer is using a compatible material, preferably one of the ones included with the tool itself or any material with a _2DReflectionTex property. For better results, set the color of the sprite to a dark gray or black. Since reflections are blended in an additive way, if your sprite is set to a white color the resulting reflection may appear too bright or whited out | Once the sprite is ready, simply add the PIDI_2DReflections component to it and ensure that your Sprite Renderer is using a compatible material, preferably one of the ones included with the tool itself or any material with a _2DReflectionTex property. For better results, set the color of the sprite to a dark gray or black. Since reflections are blended in an additive way, if your sprite is set to a white color the resulting reflection may appear too bright or whited out | ||
- | ### | + | </ |
\\ | \\ | ||
{{ : | {{ : | ||
\\ | \\ | ||
- | ### | + | <WRAP justify> |
To avoid recursive reflections ( when a mirror reflects itself while reflecting another mirror ) any object with the PIDI_2DReflections component must be in a layer which will not be reflected. By default, PIDI_2DReflections ignores the " | To avoid recursive reflections ( when a mirror reflects itself while reflecting another mirror ) any object with the PIDI_2DReflections component must be in a layer which will not be reflected. By default, PIDI_2DReflections ignores the " | ||
- | ### | + | </ |
\\ | \\ | ||
- | ### | + | <WRAP justify> |
{{ : | {{ : | ||
\\ | \\ | ||
Inside the Reflection Settings Tab you can adjust the Reflection' | Inside the Reflection Settings Tab you can adjust the Reflection' | ||
- | ### | + | </ |
- | ### | + | <WRAP justify> |
If your scene is not too complex or if you are targeting small screen devices such as mobile phones or consoles, you may want to test the Resolution Multiplier slider, which will allow you to downscale the final resolution of the rendered reflection. | If your scene is not too complex or if you are targeting small screen devices such as mobile phones or consoles, you may want to test the Resolution Multiplier slider, which will allow you to downscale the final resolution of the rendered reflection. | ||
- | ### | + | </ |
- | ### | + | <WRAP justify> |
Alternatively, | Alternatively, | ||
- | ### | + | </ |
- | + | <WRAP justify> | |
- | ### | + | |
For more information about what the rest of the settings do and how to use them you can read the rest of this online documentation, | For more information about what the rest of the settings do and how to use them you can read the rest of this online documentation, | ||
- | ### | + | </ |
\\ | \\ | ||
---- | ---- | ||
Line 220: | Line 207: | ||
==== Performance tips ==== | ==== Performance tips ==== | ||
- | ### | + | <WRAP justify> |
PIDI 2D Reflections 2 has been designed to provide a careful balance between performance and flexibility. Just like any other real time reflections system it depends on re-drawing the scene for each reflection which, depending on the complexity of the game, may have a greater or lower performance impact. | PIDI 2D Reflections 2 has been designed to provide a careful balance between performance and flexibility. Just like any other real time reflections system it depends on re-drawing the scene for each reflection which, depending on the complexity of the game, may have a greater or lower performance impact. | ||
- | ### | + | </ |
- | ### | + | <WRAP justify> |
Reflecting Post Process Effects, masking reflections or using Parallax backgrounds make the reflections even more expensive. There might be cases where it will be unavoidable to enable these effects and, in those cases sharing reflection textures can be a good option to keep an acceptable performance. | Reflecting Post Process Effects, masking reflections or using Parallax backgrounds make the reflections even more expensive. There might be cases where it will be unavoidable to enable these effects and, in those cases sharing reflection textures can be a good option to keep an acceptable performance. | ||
- | ### | + | </ |
- | ### | + | <WRAP justify> |
It is highly recommended to share a single reflection mask on as many reflections as possible, since masks can be quite expensive to render. By assigning a static RenderTexture as the output for the mask rendering the performance impact can be reduced since this static texture can be assigned to multiple reflection instances while letting only one make the actual rendering. | It is highly recommended to share a single reflection mask on as many reflections as possible, since masks can be quite expensive to render. By assigning a static RenderTexture as the output for the mask rendering the performance impact can be reduced since this static texture can be assigned to multiple reflection instances while letting only one make the actual rendering. | ||
- | ### | + | </ |
- | ### | + | <WRAP justify> |
Reflection textures can also be shared, but due to the way reflections work they can only be shared across objects located at the same Y or X coordinate (depending on the orientation) and when all the mirrors share the same orientation. | Reflection textures can also be shared, but due to the way reflections work they can only be shared across objects located at the same Y or X coordinate (depending on the orientation) and when all the mirrors share the same orientation. | ||
- | ### | + | </ |
- | ### | + | <WRAP justify> |
If using Post Process effects, it is recommended to reduce the resolution of the reflections to improve performance, | If using Post Process effects, it is recommended to reduce the resolution of the reflections to improve performance, | ||
- | ### | + | </ |
- | ### | ||
- | LWRP is a rendering pipeline still in development by Unity and, as such, has several limitations when compared to the Standard Pipeline. The lack of a proper manual rendering function as well as additional data required for the cameras to work mean that the performance of reflections in LWRP is usually lower. Besides this, due to a lack of support for Camera stacking, LWRP is not compatible with Parallax Backgrounds. All other features are available, but might be slower. | ||
- | ### | ||
\\ | \\ | ||
Line 253: | Line 237: | ||
==== User Interface ==== | ==== User Interface ==== | ||
{{ : | {{ : | ||
- | ### | + | <WRAP justify> |
The user interface for PIDI 2D Reflections 2 has been designed to be as simple and efficient as possible. When you first add the PIDI_2DReflections component to a sprite you will notice that only a handful of tabs with some options inside are available. | The user interface for PIDI 2D Reflections 2 has been designed to be as simple and efficient as possible. When you first add the PIDI_2DReflections component to a sprite you will notice that only a handful of tabs with some options inside are available. | ||
- | ### | + | </ |
- | ### | + | <WRAP justify> |
In the General Settings tab you can find several toggles to enable and disable additional features on your reflection and, as you do, additional tabs will appear. Features that are not compatible with the settings you are using will automatically disappear, help boxes will pop up to give detailed explanations for everything. | In the General Settings tab you can find several toggles to enable and disable additional features on your reflection and, as you do, additional tabs will appear. Features that are not compatible with the settings you are using will automatically disappear, help boxes will pop up to give detailed explanations for everything. | ||
- | ### | + | </ |
\\ | \\ | ||
- | ### | + | <WRAP justify> |
At the top of the UI for the tool you can always find, next to the name and logo, the current version you are using. After installing any update to this asset always verify a correct installation by checking that the version number displayed in the UI matches the installed update. | At the top of the UI for the tool you can always find, next to the name and logo, the current version you are using. After installing any update to this asset always verify a correct installation by checking that the version number displayed in the UI matches the installed update. | ||
- | ### | + | </ |
\\ | \\ | ||
---- | ---- | ||
==== Basic Reflection Settings ==== | ==== Basic Reflection Settings ==== | ||
- | ### | + | <WRAP justify> |
In this section we will cover the basic features of PIDI 2D Reflections 2, how to use them and how the affect the resulting reflections. Several images, GIFS and other resources are included to provide a deep enough learning material. Reading this whole section is heavily recommended before using PIDI 2D Reflections 2. | In this section we will cover the basic features of PIDI 2D Reflections 2, how to use them and how the affect the resulting reflections. Several images, GIFS and other resources are included to provide a deep enough learning material. Reading this whole section is heavily recommended before using PIDI 2D Reflections 2. | ||
- | ### | + | </ |
\\ | \\ | ||
=== Reflection Tint and Resolution === | === Reflection Tint and Resolution === | ||
Line 275: | Line 259: | ||
{{ : | {{ : | ||
\\ | \\ | ||
- | ### | + | <WRAP justify> |
The Reflection Tint controls the final color applied to the reflection. This color is multiplicative meaning that if your reflection has a mostly red color and you add a blue tint to it, the result will look mostly purple. | The Reflection Tint controls the final color applied to the reflection. This color is multiplicative meaning that if your reflection has a mostly red color and you add a blue tint to it, the result will look mostly purple. | ||
- | ### | + | </ |
- | ### | + | <WRAP justify> |
Furthermore, | Furthermore, | ||
- | ### | + | </ |
- | ### | + | <WRAP justify> |
The best results for reflections are achieved when a dark sprite color is mixed with a lighter reflection tint, as this produces a colored, clear and evident reflection over the surface of your sprite. | The best results for reflections are achieved when a dark sprite color is mixed with a lighter reflection tint, as this produces a colored, clear and evident reflection over the surface of your sprite. | ||
- | ### | + | </ |
\\ | \\ | ||
- | ### | + | <WRAP justify> |
If you need different blending techniques for your sprites or for the reflection then you may need to create your own custom shaders that integrate this system. Please refer to the Additional Topics section at the end of this article to learn more about how to integrate PIDI 2D Reflections 2 to custom shaders. | If you need different blending techniques for your sprites or for the reflection then you may need to create your own custom shaders that integrate this system. Please refer to the Additional Topics section at the end of this article to learn more about how to integrate PIDI 2D Reflections 2 to custom shaders. | ||
- | ### | + | </ |
\\ | \\ | ||
{{ : | {{ : | ||
\\ | \\ | ||
- | ### | + | <WRAP justify> |
If no Target Texture texture has been assigned to the reflection you can adjust its resolution to any value you want between 0.1 and 1.0. | If no Target Texture texture has been assigned to the reflection you can adjust its resolution to any value you want between 0.1 and 1.0. | ||
- | ### | + | </ |
- | ### | + | <WRAP justify> |
These adjustments can be a great help when optimizing a scene and the resources each reflection takes, especially when using Post Process Effects. | These adjustments can be a great help when optimizing a scene and the resources each reflection takes, especially when using Post Process Effects. | ||
- | ### | + | </ |
- | ### | + | <WRAP justify> |
The resolution of the reflection can also be changed at run-time allowing for further control over its quality and a better adaptation to the end user's device, making it possible to adjust on the fly towards higher qualities or higher performance. | The resolution of the reflection can also be changed at run-time allowing for further control over its quality and a better adaptation to the end user's device, making it possible to adjust on the fly towards higher qualities or higher performance. | ||
- | ### | + | </ |
\\ | \\ | ||
=== Reflection Surface and Layers === | === Reflection Surface and Layers === | ||
- | ### | + | <WRAP justify> |
Each reflection is calculated and displayed using the origin of the object / sprite as a reference. All internal calculations expect this origin to be located on the upper edge of the sprite. | Each reflection is calculated and displayed using the origin of the object / sprite as a reference. All internal calculations expect this origin to be located on the upper edge of the sprite. | ||
- | ### | + | </ |
{{ : | {{ : | ||
- | ### | + | <WRAP justify> |
This however, doesn' | This however, doesn' | ||
- | ### | + | </ |
- | ### | + | <WRAP justify> |
**Notice : In the Lite Edition of this tool, reflections can only be displayed in a Horizontal or Vertical direction and have to be marked as such by enabling the corresponding features in the Reflection Settings tab.** | **Notice : In the Lite Edition of this tool, reflections can only be displayed in a Horizontal or Vertical direction and have to be marked as such by enabling the corresponding features in the Reflection Settings tab.** | ||
- | ### | + | </ |
\\ | \\ | ||
{{ : | {{ : | ||
\\ | \\ | ||
- | ### | + | <WRAP justify> |
The distance between the edge of the reflection and the origin of the sprite can be modified with the Surface Offset value in the Reflection Settings tab. This displacement is based on the Y axis of the sprite. | The distance between the edge of the reflection and the origin of the sprite can be modified with the Surface Offset value in the Reflection Settings tab. This displacement is based on the Y axis of the sprite. | ||
- | ### | + | </ |
- | ### | + | <WRAP justify> |
Each reflection can reflect any number of layers. Selecting which layers the reflection renders and which ones it ignores can be a great aid when trying to optimize a scene since not all objects might need to be re-drawn by each reflection and thus, by ignoring some of them, the performance can be improved. | Each reflection can reflect any number of layers. Selecting which layers the reflection renders and which ones it ignores can be a great aid when trying to optimize a scene since not all objects might need to be re-drawn by each reflection and thus, by ignoring some of them, the performance can be improved. | ||
- | ### | + | </ |
\\ | \\ | ||
=== Faded and Skewed Reflections === | === Faded and Skewed Reflections === | ||
Line 334: | Line 318: | ||
{{ : | {{ : | ||
\\ | \\ | ||
- | ### | + | <WRAP justify> |
The reflections produced with this tool can be faded out either to the sprite color or to full transparency (if the Remove Backgrounds feature is enabled). | The reflections produced with this tool can be faded out either to the sprite color or to full transparency (if the Remove Backgrounds feature is enabled). | ||
- | ### | + | </ |
- | ### | + | <WRAP justify> |
This is useful to produce more artistic results with the reflections for cases where you need to reflect text or other elements during cutscenes or menus, etc. | This is useful to produce more artistic results with the reflections for cases where you need to reflect text or other elements during cutscenes or menus, etc. | ||
- | ### | + | </ |
- | ### | + | <WRAP justify> |
The fading effect is applied ONLY to the reflection itself, and it does not fade the rest of the sprite nor its colors. | The fading effect is applied ONLY to the reflection itself, and it does not fade the rest of the sprite nor its colors. | ||
- | ### | + | </ |
\\ | \\ | ||
- | ### | + | <WRAP justify> |
Notice : At the moment, PIDI 2D Reflections 2 is not capable of reflecting UI Elements nor anything rendered through the Canvas system. | Notice : At the moment, PIDI 2D Reflections 2 is not capable of reflecting UI Elements nor anything rendered through the Canvas system. | ||
- | ### | + | </ |
- | ### | + | <WRAP justify> |
The Standard Edition includes the ability to further control the appearance of the reflection by modifying its projection parameters and skewing the results. This means that the reflection can be projected in a distorted way to simulate different perspectives over the surface. | The Standard Edition includes the ability to further control the appearance of the reflection by modifying its projection parameters and skewing the results. This means that the reflection can be projected in a distorted way to simulate different perspectives over the surface. | ||
- | ### | + | </ |
\\ | \\ | ||
{{ : | {{ : | ||
\\ | \\ | ||
- | ### | + | <WRAP justify> |
To use skewed reflections with PIDI 2D Reflections 2 simply enable this feature (you can find it in the Reflection Settings tab) and use the sliders to control the appearance, scale and offset of the top and bottom edges of the projection. While the control provided over the projection is limited (since otherwise the whole reflection might be broken) it still provides enough control to achieve highly interesting results. | To use skewed reflections with PIDI 2D Reflections 2 simply enable this feature (you can find it in the Reflection Settings tab) and use the sliders to control the appearance, scale and offset of the top and bottom edges of the projection. While the control provided over the projection is limited (since otherwise the whole reflection might be broken) it still provides enough control to achieve highly interesting results. | ||
- | ### | + | </ |
\\ | \\ | ||
=== Distortion Maps === | === Distortion Maps === | ||
- | ### | + | <WRAP justify> |
All included shaders support the use of distortion maps. The map itself has to be assigned to the material but the specific properties of the distortion map including its strength, the UV space in which it is projected as well as its scale can be defined on a per-instance basis. | All included shaders support the use of distortion maps. The map itself has to be assigned to the material but the specific properties of the distortion map including its strength, the UV space in which it is projected as well as its scale can be defined on a per-instance basis. | ||
- | ### | + | </ |
\\ | \\ | ||
{{ : | {{ : | ||
\\ | \\ | ||
- | ### | + | <WRAP justify> |
Depending on the effect that you want to achieve you may want to select different UV spaces for the distortion. The four available projections for the distortion map are Local Space which refers to the actual UV coordinates of the sprite, Reflection Space which refers to the coordinates calculated to project the reflection and which can be skewed alongside it, Screen Space and World Space. The Distortion Map Scale is applied on the corresponding UV space. | Depending on the effect that you want to achieve you may want to select different UV spaces for the distortion. The four available projections for the distortion map are Local Space which refers to the actual UV coordinates of the sprite, Reflection Space which refers to the coordinates calculated to project the reflection and which can be skewed alongside it, Screen Space and World Space. The Distortion Map Scale is applied on the corresponding UV space. | ||
- | ### | + | </ |
---- | ---- | ||
\\ | \\ | ||
==== Advanced Reflection Settings ==== | ==== Advanced Reflection Settings ==== | ||
- | ### | + | <WRAP justify> |
The topics included in this section are intended for more advanced uses of the tool and may require a different scene setup and design in order to work correctly. Furthermore, | The topics included in this section are intended for more advanced uses of the tool and may require a different scene setup and design in order to work correctly. Furthermore, | ||
- | ### | + | </ |
=== Post Process FX === | === Post Process FX === | ||
- | ### | + | <WRAP justify> |
PIDI 2D Reflections 2 is designed to work out of the box with the Post Process Stack v2. Once this package is installed into your project either through the Package Manager (Unity 2018.3+) or manually, everything you need to do to take advantage of PostFX in your reflections is to enable them in the General Settings tab | PIDI 2D Reflections 2 is designed to work out of the box with the Post Process Stack v2. Once this package is installed into your project either through the Package Manager (Unity 2018.3+) or manually, everything you need to do to take advantage of PostFX in your reflections is to enable them in the General Settings tab | ||
- | ### | + | </ |
\\ | \\ | ||
{{ : | {{ : | ||
\\ | \\ | ||
- | ### | + | <WRAP justify> |
There are however a few considerations to take into account when using Post FX with our reflections system : | There are however a few considerations to take into account when using Post FX with our reflections system : | ||
- | ### | + | </ |
* Effects dependent on Motion Vectors (Motion Blur, TAA) are not compatible and cannot be rendered within the reflection itself | * Effects dependent on Motion Vectors (Motion Blur, TAA) are not compatible and cannot be rendered within the reflection itself | ||
Line 393: | Line 377: | ||
\\ | \\ | ||
- | ### | + | <WRAP justify> |
Starting with PIDI 2D Reflections 2 version 2.1 there are two different ways to configure the Post FX support of each reflection, either copying the settings from the camera that looks at the reflection itself (in most cases the game camera) or by setting up a custom set of overrides, which allows you to set unique PostFX volumes for the reflections that are independent from those used for the rest of the game. | Starting with PIDI 2D Reflections 2 version 2.1 there are two different ways to configure the Post FX support of each reflection, either copying the settings from the camera that looks at the reflection itself (in most cases the game camera) or by setting up a custom set of overrides, which allows you to set unique PostFX volumes for the reflections that are independent from those used for the rest of the game. | ||
- | ### | + | </ |
- | ### | + | <WRAP justify> |
When enabling the POST PROCESS FX SUPPORT setting on the General Settings tab you will see a new tab appear on the UI called POST FX SETTINGS | When enabling the POST PROCESS FX SUPPORT setting on the General Settings tab you will see a new tab appear on the UI called POST FX SETTINGS | ||
- | ### | + | </ |
\\ | \\ | ||
Line 405: | Line 389: | ||
\\ | \\ | ||
- | ### | + | <WRAP justify> |
The POST FX SETTINGS MODE allows you to select from where will the POST FX SETTINGS for this reflection be read from, either the game camera or a custom set of options. If you use CUSTOM SETTINGS then a set of controls corresponding to a default POST PROCESS LAYER will appear. For additional information about these settings please read the [[https:// | The POST FX SETTINGS MODE allows you to select from where will the POST FX SETTINGS for this reflection be read from, either the game camera or a custom set of options. If you use CUSTOM SETTINGS then a set of controls corresponding to a default POST PROCESS LAYER will appear. For additional information about these settings please read the [[https:// | ||
- | ### | + | </ |
- | ### | + | <WRAP justify> |
- | This system may not be fully compatible with custom Post Process FX nor is compatible with third party tools. The PostFX compatibility of PIDI 2D Reflections 2 is limited and designed only for the Post Process Stack v2 (Standard Renderer | + | This system may not be fully compatible with custom Post Process FX nor is compatible with third party tools. The PostFX compatibility of PIDI 2D Reflections 2 is limited and designed only for the Post Process Stack v2 (Standard Renderer) and v3 (Universal RP). |
- | ### | + | </ |
\\ | \\ | ||
=== Masked Reflections (Standard Only)=== | === Masked Reflections (Standard Only)=== | ||
- | ### | + | <WRAP justify> |
Sometimes it is necessary to render a reflection over a large surface while keeping only some parts of it visible. This is especially true when using local reflections over other reflective surfaces. To achieve this effect and ensure that your reflection is visible ONLY when it is over another object you need to use the Masked Reflections feature, which can be enabled in the General Settings tab. | Sometimes it is necessary to render a reflection over a large surface while keeping only some parts of it visible. This is especially true when using local reflections over other reflective surfaces. To achieve this effect and ensure that your reflection is visible ONLY when it is over another object you need to use the Masked Reflections feature, which can be enabled in the General Settings tab. | ||
- | ### | + | </ |
\\ | \\ | ||
{{ : | {{ : | ||
\\ | \\ | ||
- | ### | + | <WRAP justify> |
Once enabled, a new settings tab will appear called " | Once enabled, a new settings tab will appear called " | ||
- | ### | + | </ |
- | ### | + | <WRAP justify> |
Just as when rendering the reflection itself to an external texture, if a Target Texture is assigned and Passive mode is disabled, this reflection will render its mask to the RenderTexture. If Passive mode is enabled, the RenderTexture will be read instead, saving performance. This way it is possible to have only one instance with Passive mode disabled and rendering its mask to a RenderTexture while all the others just read from it. | Just as when rendering the reflection itself to an external texture, if a Target Texture is assigned and Passive mode is disabled, this reflection will render its mask to the RenderTexture. If Passive mode is enabled, the RenderTexture will be read instead, saving performance. This way it is possible to have only one instance with Passive mode disabled and rendering its mask to a RenderTexture while all the others just read from it. | ||
- | ### | + | </ |
\\ | \\ | ||
=== Parallax Reflections (Standard Only)=== | === Parallax Reflections (Standard Only)=== | ||
- | ### | + | <WRAP justify> |
PIDI 2D Reflections 2 is also compatible with [[https:// | PIDI 2D Reflections 2 is also compatible with [[https:// | ||
- | ### | + | </ |
- | ### | + | <WRAP justify> |
You can enable this feature directly in the General Settings tab. Once enabled, a new settings tab called " | You can enable this feature directly in the General Settings tab. Once enabled, a new settings tab called " | ||
- | ### | + | </ |
\\ | \\ | ||
{{ : | {{ : | ||
\\ | \\ | ||
- | ### | + | <WRAP justify> |
Once Parallax Reflections are enabled, all you have to do to make use of them is to assign the cameras of your scene to its camera' | Once Parallax Reflections are enabled, all you have to do to make use of them is to assign the cameras of your scene to its camera' | ||
- | ### | + | </ |
- | ### | + | <WRAP justify> |
**Notice : Parallax Reflections are NOT previewable in the Scene view due to the way they are handled. They can only be previewed in the Game View.** | **Notice : Parallax Reflections are NOT previewable in the Scene view due to the way they are handled. They can only be previewed in the Game View.** | ||
- | ### | + | </ |
=== Local Reflections === | === Local Reflections === | ||
- | ### | + | <WRAP justify> |
Local reflections are designed for specific cases where you need a reflection to follow an object ( for example a character ) and to move with it over another reflective surface. This is useful to better simulate water surfaces and floors where the characters and objects may need to move over the surface without having their reflections disappear. | Local reflections are designed for specific cases where you need a reflection to follow an object ( for example a character ) and to move with it over another reflective surface. This is useful to better simulate water surfaces and floors where the characters and objects may need to move over the surface without having their reflections disappear. | ||
- | ### | + | </ |
- | ### | + | <WRAP justify> |
PIDI 2D Reflections 2 provides a basic integrated workflow for this behavior, but it works with horizontal reflections ONLY. | PIDI 2D Reflections 2 provides a basic integrated workflow for this behavior, but it works with horizontal reflections ONLY. | ||
- | ### | + | </ |
\\ | \\ | ||
{{ : | {{ : | ||
\\ | \\ | ||
- | ### | + | <WRAP justify> |
In the General Settings Tab you can find the feature Local Reflections. Once enabled, a new tab with the corresponding settings will appear. | In the General Settings Tab you can find the feature Local Reflections. Once enabled, a new tab with the corresponding settings will appear. | ||
- | ### | + | </ |
- | ### | + | <WRAP justify> |
Inside the Local Reflections Settings tab you can control the horizontal and vertical limits of the local reflection. These limits are represented in the scene view as red and blue lines and help you to limit the are in which the local reflection will follow the target object. In the Multi-Effects demo scene included with the package the local reflection has been set up to be masked as well, to prevent it from displaying outside of the boundaries of the reflective floor. | Inside the Local Reflections Settings tab you can control the horizontal and vertical limits of the local reflection. These limits are represented in the scene view as red and blue lines and help you to limit the are in which the local reflection will follow the target object. In the Multi-Effects demo scene included with the package the local reflection has been set up to be masked as well, to prevent it from displaying outside of the boundaries of the reflective floor. | ||
- | ### | + | </ |
\\ | \\ | ||
{{ : | {{ : | ||
\\ | \\ | ||
- | ### | + | <WRAP justify> |
The Target Transform slot should receive the transform / object that you want the local reflection to follow. Once this is done, you just need to set up the Reflection Layers (inside of Reflection Settings) to be the same as the layer of the object you want to reflect. Local reflections are designed to reflect only one object at a time, so they require a careful layer management in order to achieve the best results. | The Target Transform slot should receive the transform / object that you want the local reflection to follow. Once this is done, you just need to set up the Reflection Layers (inside of Reflection Settings) to be the same as the layer of the object you want to reflect. Local reflections are designed to reflect only one object at a time, so they require a careful layer management in order to achieve the best results. | ||
- | ### | + | </ |
\\ | \\ | ||
---- | ---- | ||
Line 477: | Line 461: | ||
==== Additional Topics ==== | ==== Additional Topics ==== | ||
=== Shader Based Reflections === | === Shader Based Reflections === | ||
- | ### | + | <WRAP justify> |
Included with this tool are two shaders that generate reflections without any additional components. These shaders are designed for ultra-fast performance and can, with some tweaks in the scene, reflect both Parallax backgrounds and PostFX. | Included with this tool are two shaders that generate reflections without any additional components. These shaders are designed for ultra-fast performance and can, with some tweaks in the scene, reflect both Parallax backgrounds and PostFX. | ||
- | ### | + | </ |
\\ | \\ | ||
Line 486: | Line 470: | ||
- | ### | + | <WRAP justify> |
These shaders however have many important limitations when compared to the usual reflections that PIDI 2D Reflections 2 produces and should be used sparingly, mostly in cases where performance is a much higher priority than quality. | These shaders however have many important limitations when compared to the usual reflections that PIDI 2D Reflections 2 produces and should be used sparingly, mostly in cases where performance is a much higher priority than quality. | ||
- | ### | + | </ |
- | ### | + | <WRAP justify> |
The limits of the Shader based reflections are the following : | The limits of the Shader based reflections are the following : | ||
Line 500: | Line 484: | ||
- | ### | + | </ |
\\ | \\ | ||
=== Custom Shaders (Code based) === | === Custom Shaders (Code based) === | ||
- | ### | + | <WRAP justify> |
Custom shaders can be created to expand or customize the behavior of the reflections and achieve different effects. To be recognized by this tool as a PIDI 2D Reflections compatible shader, your shader must contain the following parameters : | Custom shaders can be created to expand or customize the behavior of the reflections and achieve different effects. To be recognized by this tool as a PIDI 2D Reflections compatible shader, your shader must contain the following parameters : | ||
- | ### | + | </ |
* _2DReflectionTex as a 2D sampler | * _2DReflectionTex as a 2D sampler | ||
* _SurfaceXY as a Vector4 parameter | * _SurfaceXY as a Vector4 parameter | ||
- | ### | + | <WRAP justify> |
Additionally, | Additionally, | ||
- | ### | + | </ |
- | ### | + | <WRAP justify> |
This guide will not cover how to write custom shaders, as this is a very extensive topic much better covered by other articles, guides and tutorials. There are however a few technical details that might be useful for you when deciding how to handle the reflection output from our tool in your own shaders : | This guide will not cover how to write custom shaders, as this is a very extensive topic much better covered by other articles, guides and tutorials. There are however a few technical details that might be useful for you when deciding how to handle the reflection output from our tool in your own shaders : | ||
- | ### | + | </ |
* The reflection texture output is not flipped nor mirrored. It is rendered in a default Y up orientation with its lowest edge matching the edge of the reflective surface. | * The reflection texture output is not flipped nor mirrored. It is rendered in a default Y up orientation with its lowest edge matching the edge of the reflective surface. | ||
Line 526: | Line 510: | ||
=== Custom Shaders (Amplify Shader Editor) === | === Custom Shaders (Amplify Shader Editor) === | ||
- | ### | + | <WRAP justify> |
Creating custom shaders with ASE (Amplify Shader Editor) that are compatible with all effects and features of PIDI 2D Reflections 2 is extremely fast and easy in both Lite and Standard Editions of this asset. | Creating custom shaders with ASE (Amplify Shader Editor) that are compatible with all effects and features of PIDI 2D Reflections 2 is extremely fast and easy in both Lite and Standard Editions of this asset. | ||
- | ### | + | </ |
- | ### | + | <WRAP justify> |
First, install ASE into your project. Afterwards, unpack the ASE Samples Pack.unitypackage file into your project. It contains two already made copies of the standard shaders re-written with ASE Nodes as well as a special [[http:// | First, install ASE into your project. Afterwards, unpack the ASE Samples Pack.unitypackage file into your project. It contains two already made copies of the standard shaders re-written with ASE Nodes as well as a special [[http:// | ||
- | ### | + | </ |
\\ | \\ | ||
{{ : | {{ : | ||
\\ | \\ | ||
- | ### | + | <WRAP justify> |
In most cases, you will want to plug the Final Reflection (RGB) output from the 2D Reflection Outputs node to the Emission output of your shader and its Background & Masked Alpha output to the Opacity output of your shader. | In most cases, you will want to plug the Final Reflection (RGB) output from the 2D Reflection Outputs node to the Emission output of your shader and its Background & Masked Alpha output to the Opacity output of your shader. | ||
- | ### | + | </ |
\\ | \\ | ||
{{ : | {{ : | ||
\\ | \\ | ||
- | ### | + | <WRAP justify> |
For a more detailed description of this whole process, please watch the small video tutorial below. | For a more detailed description of this whole process, please watch the small video tutorial below. | ||
- | ### | + | </ |
{{ youtube> | {{ youtube> | ||
Line 551: | Line 535: | ||
=== Custom Shaders (ShaderGraph Editor) === | === Custom Shaders (ShaderGraph Editor) === | ||
- | ### | + | <WRAP justify> |
- | Starting with version 2.07, the LWRP Add on package of PIDI 2D Reflections 2 comes with an additional package called " | + | Starting with version 2.07, the Universal RP Add on package of PIDI 2D Reflections 2 comes with an additional package called " |
- | ### | + | </ |
\\ | \\ | ||
Line 560: | Line 544: | ||
- | ### | + | <WRAP justify> |
To make the process of creating your own custom shaders as easy as possible, the subgraph included with the Shader Graph elements includes all the inputs that you will need to use PIDI 2D Reflections and their names are the exact names you need to give each parameter so that they can be automatically managed by the PIDI 2D Reflections component | To make the process of creating your own custom shaders as easy as possible, the subgraph included with the Shader Graph elements includes all the inputs that you will need to use PIDI 2D Reflections and their names are the exact names you need to give each parameter so that they can be automatically managed by the PIDI 2D Reflections component | ||
- | ### | + | </ |
\\ | \\ | ||
Line 568: | Line 552: | ||
\\ | \\ | ||
- | ### | + | <WRAP justify> |
Remember that in ShaderGraph the parameter names you assign are not the same as the ones used by the shaders internally. However, PIDI 2D Reflections requires these names to be the same, except that the internal names or References must have a " | Remember that in ShaderGraph the parameter names you assign are not the same as the ones used by the shaders internally. However, PIDI 2D Reflections requires these names to be the same, except that the internal names or References must have a " | ||
- | ### | + | </ |
\\ | \\ | ||
Line 576: | Line 560: | ||
\\ | \\ | ||
- | ### | + | <WRAP justify> |
While a lot of effort was put into making sure that all shader editors have the easiest workflow possible, ShaderGraph is still an evolving tool that receives new features on each iteration. One such feature is the Custom Function node, added in Unity 2019.2 but non-existent in 2019.1. Due to these differences, | While a lot of effort was put into making sure that all shader editors have the easiest workflow possible, ShaderGraph is still an evolving tool that receives new features on each iteration. One such feature is the Custom Function node, added in Unity 2019.2 but non-existent in 2019.1. Due to these differences, | ||
- | ### | + | </ |
\\ | \\ | ||
\\ | \\ | ||
- | ### | + | <WRAP justify> |
If you have additional questions about the functionality of our tool or are having issues with any of the components included with it please don't hesitate in contacting us at our [[support@irreverent-software.com|support email]]. | If you have additional questions about the functionality of our tool or are having issues with any of the components included with it please don't hesitate in contacting us at our [[support@irreverent-software.com|support email]]. | ||
- | ### | + | </ |
\\ | \\ | ||
\\ | \\ | ||
- | ### | + | <WRAP justify> |
- | // | + | // |
- | ### | + | </ |