Blender Outline Material Node

Blender Outline Material Node

Contents

(Top)
Getting Started
The Outline Node
  2.1  How it works / How to use it
  2.2  Limitations and Know Issues
    2.2.1  Limitations
    2.2.2  Known Issues (can be fixed)
Sockets
  3.1  Input
    3.1.1  Normal
    3.1.2  Width
  3.2  Output
    3.2.1  Depth
    3.2.2  Depth Hit Position
    3.2.3  Negative Depth
    3.2.4  Negative Depth Hit Position
    3.2.5  Object (Cycles only)
    3.2.6  Width WorldSpace Size
Q&A

   

Getting Started

The Outline Material Node is a new line rendering node for the Blender Eevee and Cycles render engines.

Until it gets integrated into the main version of Blender you can get it on Gumroad.

On the downloads you will find a build of Blender 2.82a with this patch applied and an example .blend file with several node groups that show how to use the Outline node.

You have to open the file with this custom build of Blender, if you try to open the file with a normal blender version you will just a see a black material.

The example .blend file

   

The Outline Node

You can find the node at Add>Input>Outline

Since the node is a work-in-progress, it's still not as easy to use as it could be. Instead, it provides as many options as possible to let users experiment and setup their own custom line styles.

   

How it works / How to use it

To be able to use the node to its full capabilities, it's better to have a basic understanding of how it works under the hood.

The node works by calculating the depth difference between the point that is currently being shaded and the points in the screen at the left, rigth, top and down of it.

Instead of simply calculating the depth difference as is, it calculates the difference with the expected depth at the offsets, taking the shaded point normal into account.

For example, if the point being shaded is part of a plane, and the plane is not perpendicular to the camera, the points at the offsets will have different depths, so using the depth difference as is would yield unwanted results.

This also means that the larger the difference between the shading normal and the real geometry normal, the more incorrect are the results.

If your mesh uses Custom Normals, you might want to use the True Normal output from the Geometry node.

If you are using Smooth Normals on very low resolution meshes you will get better results by subdividing the mesh.

Left: 1 subdivision, Line Detail = 0.2

Center: 1 subdivision, Line Detail = 2.0

Right: 4 subdivisions, Line Detail = 2.0

Then it checks all the depth diferences at the offsets - it separates the depths that are farther than expeceted (Depth), and the depths that are closer than expected (Negative Depth) - and outputs the largests ones.

Depth VS Negative Depth

The simplest way to use the node is to check if the depth is larger than some threshold (Math node > Greater Than) and then use the result as factor for a Mix RGB or Mix Shader node.

Basic Setup

You will get more consistent results regardless of camera angle and object distance if you divide the Depth by Width WorldSpace Size before connecting it to the Greater Than node.

(Click to enlarge)

Notice how distant objects looks much better on the right image, after dividing the depth by Width WorldSpace Size and adjusting the threshold.

   

Limitations and Know Issues

   

Limitations

   

Known Issues (can be fixed)

   

Sockets

Node Sockets

   

Input

   

Normal

The normal used to calculate the expected depth at the offsets. If nothing is connected the default shading normal is used.

   

Width

The size in screen-space of the offsets (in pixels).

   

Output

   

Depth

The maximum depth difference where the real depth is farther than the expected depth. (in Blender units)

   

Depth Hit Position

The delta vector between the point being shaded and the Depth hit point. (in Blender units)

   

Negative Depth

The maximum depth difference where the real depth is closer than the expected depth. (in Blender units)

   

Negative Depth Hit Position

The delta vector between the point being shaded and the Negative Depth hit point. (in Blender units)

   

Object (Cycles only)

Outputs 1 if there is another object at (at least) one of the offsets, outputs 0 otherwise.

   

Width WorldSpace Size

The size in world-space of the offsets (in Blender units).

   

Q&A

TO DO

formatted by Markdeep 1.18