Edge Detection
Edge Detection renders outlines as a full-screen effect by detecting edges and discontinuities within the scene. It is able to create a consistent outline across the whole scene.
✅ Advantages
- Consistent Outline: As a screen-space effect, the outline is uniformly applied across the whole scene, ensuring a consistent look.
- Inner Lines: The effect is able to capture both internal lines as lines on the outside of objects.
❌ Disadvantages
- Object Exclusion: It’s less straightforward (though possible!) to exclude specific objects or customize the outline effect for individual objects.
- Performance: This is a screen-space effect that runs for the whole screen.
Jump to heading Discontinuity Sources
The Edge Detection effect is able to use a combination of discontinuity sources to determine where a line should be drawn.
Given a scene, a combination of the following discontinuity sources may be used.
Depth The depth of each fragment in the scene. Works well to get the silhouettes of objects.
Normals The orientation of each fragment in the scene. Works well to get fine details in objects if they have a different orientation.
Luminance The luminance of each fragment in the scene. Works well to pick up on differences in color/brightness between surfaces, even if they have the same orientation.
Combined By combining depth, normals and luminance, the outlines come out like this.
Jump to heading Configuration
The Edge Detection Settings object contains the settings related to this outline effect.
General Settings
The general settings apply to the outline effect as a whole.
Property | Description |
---|---|
Stage | Controls when the render pass executes. |
Show In Scene View | Sets whether to render the pass in the scene view. |
Debug | Which stage to render as a debug view. |
Discontinuity Settings
This setting controls which inputs to use as discontinuity sources for the edge detection.
These setting control the generation of the section map.
Setting | Description |
---|---|
Layer | The rendering layer(s) which will get rendered to the section map. |
Object ID | Whether to render each object with a unique ID to the section map. |
Input | The additional input used for the section map. |
Channel | Which vertex color channel to render to the section map. |
Texture | Which texture to sample when rendering to the section map. |
UV Set | Which UV set to use when sampling the section texture. |
Keyword | Which keyword to enable during the rendering of the section map. |
Shader | Which shader to use to render to the section map. |
Setting (Depth) | Description |
---|---|
Sensitivity | The sensitivity used to detect the discontinuity in depth. |
Distance Mask | Adjust how sensitive the edge detection is to changes in depth based on the distance from the camera. |
Sharp Angle Mask | Helps prevent edges from being falsely detected when the camera views a surface at a shallow angle. |
Sharp Angle Mask Multiplier | Helps prevent edges from being falsely detected when the camera views a surface at a shallow angle. |
Setting (Normals) | Description |
---|---|
Sensitivity | The sensitivity used to detect the discontinuity in normal vector. |
Setting (Luminance) | Description |
---|---|
Sensitivity | The sensitivity used to detect the discontinuity in luminance. |
Outline Settings
Property | Description |
---|---|
Kernel | The kernel that is used to detect edges. |
Thickness | The thickness in pixels of the edges. |
Scale With Resolution | Scale the thickness of the edges with screen resolution to get a perceptually consistent outline across resolutions. Also allows you to set the reference resolution. |
Edge Color | The color of the edges. |
Override Shadow | The color the edges when they are in an area that lies within a shadow. |
Background Color | A color that is used for all pixels that are not an edge. Can be used for stylistic line-only renderings. |
Fill Color | The color that is used for fill regions of the section map. See section map for more info. |
Fade In Distance | Fade the edges towards another color (or transparent color) in the distance. You can set at which point the fade starts, and along which distance the fade occurs (how steep the drop-off is). |
Blend | How to blend the outline with the rest of the scene. |