Oil Paint is a post-processing effect that can turn your game into a piece of art. It is based on Anisotropic Kuwahara filter.
Once installed, select the camera of the scene and add the component ‘Oil Paint‘.
When you add it you will see something like:
In the first zone (1) you can change the strength of the effect. You can also change ‘Mode‘ between ‘Screen’, ‘Layer’, ‘Dual layer‘ and ‘Distance’. Later we will see how they work. You can also control the intensity of the effect by selecting between ‘Low‘, ‘Medium‘ or ‘High‘. If you want to manually adjust the intensity, select ‘Custom‘. Values above six may impact the performance.
You can also activate the ‘Water Color‘ mode that defines more the contours and saturates the colors. You can select how these colors are mixed with ‘Blend color’. This option increases the cost of the effect, so it is not recommended to turn it on mobile devices.
The ‘Color’ (2) area is used to modify color parameters and you must activate it (in the small circle near the label) to be able to use it.
In ‘Advanced settings’ (3) you can adjust the ‘Depth threshold‘ parameter to adjust the sensitivity in the layers mode.
Pressing at ‘[doc]’ (4) will go to the online help and in the ‘Reset‘ (5) button some parameters will return to their default values.
I said that there are four different modes. The first one is ‘Screen‘ and is the one used by default. It makes the effect apply to the whole screen. Another mode is ‘Layer‘ and with it you can apply the effect only to the layers you want.
With ‘Dual Layer‘ you can also set another intensity for the zones that are not affected by the selected layer. This can be useful if you want some objects to have better definition than others. When this mode is selected, the intensity is automatically set to ‘Custom‘ (1 the selected layer, 2 the rest).
With ‘Distance‘ mode you can select the depth curve to modulate the effects strength. The range starts at the ‘Near‘ distance of the camera and ends at ‘Far‘.
If you see any accuracy faults, you can adjust the sensitivity with ‘Depth threshold‘ at ‘Advanced settings’. Also ‘Layer‘, ‘Dual Layer‘ and ‘Distance‘, add a depth texture to the camera, and may not be available on some mobile platforms. You should also keep in mind that both modes depend on the ‘Far‘ parameter of your camera. If you use a ‘Far‘ too large (default is 1000), you may have precision problems, so I advise you to reduce it as much as possible.
‘Oil Paint‘ supports virtual reality devices (VR). You must use Unity 2017.1 or higher. As the render works on these devices, the effect is much more expensive so I recommend you use the ‘Low‘ intensity (especially in mobile VR).
At the moment, only ‘Screen‘ mode does work in VR mode.
All code is inside the namespace ‘Ibuprogames.OilPaintAsset‘ and the main component is ‘OilPaint‘. So if you want to use it you must first import its namespace:
If ‘myCamera‘ is a valid camera and you want to add the effect, you should do something like:
OilPaint oilPaint = mycamera.gameObject.AddComponen<OilPaint>();
All the code are well commented, I recommend reading the code if you want more information.
Any questions or suggestions you have, we will be happy to answer you in our mail: