Quick and easy to use outline shader for Unity, works with flat normals or smooth normals.
- Outlines for any kind of object. Works for objects with flat normals, like perfect cubes, and objects with smooth normals, like a sphere
- Silhouette that shows when object is obscured
- Easily edited outline thickness, color and alpha
- Easily animated outlines (like the outlines expanding)
- Allows for precalculating of values for the outlines
This repository is installed as a package for Unity.
Open Window>Package Manager.- Click
+. - Select Add Package from git URL.
- Paste
https://github.com/Tramshy/trashy-outlines.git. - Click Add.
NOTE: To do this you need Git installed on your computer.
- Add the
OutlineSmoothNormalMappingcomponent to your object - Precalculate smooth normals using the
Recalculate Normalsbutton component - To show the outline, add a material with the
Outlineshader and a material with theOutlineMaskshader, or setShouldAddOutlineOnAwaketo true. If one, or both, fields are left null after setting this bool to true, it will use the default outline materials and settings (which are found in the Resources folder) - If you want to programmatically animate the outline thickness, use the
_Multipliervalue from 0 - 1 to decrease and increase thickness
The outline material and mask material have their own Enums that determine how the outline will be rendered. These are set per material, so if you want different kinds of outlines you will need multiple materials.
You can also set the default outlines for an object to use if you use the ShouldAddOutlineOnAwake bool on the component, if you leave the fields as null it will use the default outline options.
This package is licensed under the MIT License. For more information read: LICENSE.