‘Oil Paint’ is the most advanced and configurable tool to give your games a unique look, easily transforming them into pieces of art.
This effect requires a decent GPU so it is not recommended for low-end mobile or VR.
Once installed, select the camera for your scene and add the ‘Oil Paint’ component. Doing so you will see something like:
With ‘Strength’ (1) you can change the overall intensity of the effect, if it is 0 the effect will be disabled.
In ‘Mode’ (2) you can select what affects ‘Oil Paint’. The first mode is ‘Screen’ and if you use it the effect will be applied to the entire screen (except the interface). If you only want it to affect objects that are in certain layers, all you have to do is select ‘Layers’ and choose the layers:
If you want to change the intensity of the effect according to the depth of the scene, choose the ‘Distance’ mode. The range starts on the ‘Near’ plane of the camera and ends on the ‘Far’ plane.
With the ‘Dual Layer’ mode you can specify two different intensities for two different layers. This can be useful to give some objects more definition than others.
In the previous example, the objects that are in the layer ‘Tree’ will have an intensity defined by ‘Custom’ and the rest of objects by ‘Custom dual’.
The next thing you can select is the type of algorithm (3) that the effect will use. The first is ‘Kawahara’. This algorithm tends to respect the strokes, although at high intensities it can deform them. It is also the most configurable of all. You can change its intensity between ‘Low’, ‘Medium’ and ‘High’. Or you can also select ‘Custom’ to adjust the intensity of the effect to your liking. Keep in mind that the higher the intensity, the greater the impact on performance.
‘Symmetric Neighborhood Neighbor’ works well at any intensity but may tend to bluish the image. The latest algorithm, ‘Tomita Tsuji’, is an improvement on the first one that adds more definition but is the most expensive of all.
To all these algorithms you can add another, ‘Water color’ (5) that further defines the contours and saturates the colors. You can modify its intensity with ‘Amount’ (6).
In ‘Color’ (7) you can activate a series of color modifiers, such as brightness (8), contrast (9), gamma (10), hue (11) and saturation (12).
The ‘Layer’, ‘Dual Layer’ and ‘Distance’ modes use a depth camera. It is recommended that you adjust the ‘Far’ distance of your camera as much as possible to gain precision and avoid mistakes.
If you still see some errors, you can adjust the precision in ‘Depth threshold’ (14).
Finally, pressing on ‘[doc]’ (15) will open the web with the documentation and if you click on ‘Reset’ (16) all the parameters will return to their default values.
All the code is inside the namespace ‘Nephasto.OilPaintAsset’ and the main component is ‘OilPaint’. The first thing you should do is import the namespace:
If ‘myCamera’ is a valid camera and you want to add the effect to it, you can do something like this:
For more information, see the code comments and the attached demo.
Any questions or suggestions you have, I will be happy to answer you in