BNPR Exclusive: Edge Nodes [Part 3]
Finally, the edge nodes are here. It has been 3 months in development, and we are proud to present edge nodes version 1.0. Since it is based on 2D image maps, it does not work the same as Freestyle–it does not use 3D data. Edge nodes simply exploits the already available edge detection filters within the Blender compositor.
Disclaimer: Edge nodes is not a replacement for Freestyle or Blender’s own “Edge” post processing option, it is meant to complement them.
How to use edge nodes
Line set setup
The essence of the setup are the line set node groups. You can either use:
- 1 line set setup (Normal and Z combined)
- 2 line sets setup (Normal and Z separated)
- more than 2 line sets setup (More than 1 normal line sets + Z line set)
The nodetree is ready for 1 line set and 2 line sets setup. For more than 2, you may need to make your own blending nodes. One line set will not likely do well on a large scene. It will likely require you to utilize render layers and object/index passes in creative ways to achieve great lines for the whole image.
There are 2 parts to make this work. First you need normal edge detection (for organic shapes), then you need Z depth edge detection (to detect parallel normals and non organic shapes). The 6 bigger node groups (with “(C)”, which means combined) have both of them inside. Next to them are separated normal and Z pass edge detection sets.
1 line set setup: (Please uncheck switch inside of Line Adjust)
Link 1 of the bigger node (with C) group to “Line 1 In” of Line Adjust node group.
2 line sets setup: (Please tick the switch inside of Line Adjust)
Z depth must be linked to “Line 1 In” of Line Adjust; then connect 1 of the normal line sets to “Line 2 In” of Line Adjust node group.
There are 2 workflows.
- append/link nodetree to another blend file
- append/link model into blend file
For appending and linking nodetree to another file, you need to know which nodetree to append/link. Depending on how many line set setup you will be using, you’ll be selecting different line sets. To be safe you just need to append/link all the nodetree. But you don’t really need to.
You must have these appended/linked:
- Line Adjust
- UI Part 2 (ungroup after linked)
For the second workflow (append model into blend file), just make sure you make a copy of the empty blend file, for backup.
What and how to tweak
- Remove noise (remove low level noise, use small value)
- Depth (if dark or bleeding, increase value)
- Level of Details (LOD) (useful on 1 line set setup, to adjust line details)
- Line 1 / 2 adjust (separated adjustment for 2 line sets setup)
- AA on/off (select to either use AA (subtract method) or non-AA lines (greater than method))
- Thickness with erode/dilate (Add thickness or lower thickness)
- Colors (change color of the edges)
Render setup: At least 5x Full Sample AA (FSAA)
The one downside to using compositor based edges is in this situation is the need for FSAA to get smooth lines. The way the line sets extract the edges breaks any anti-aliasing that would normally exist in the edge detection filters.
One solution to this issue is the use of a node that would sample and give back the AA we need without using FSAA, which can be very resource heavy. One possibility is SMAA: http://www.iryoku.com/smaa/ integrated into a new node–it can also utilize openCL.
What is going on inside the node groups
For the geeks among us, this part is for your guys.
4k normal line set:
Separate normal channel to RGB, Laplace filter to get edges, then combine the edges from each channel to product composite edges. Good for big renders, bad for close edges and small render.
Set 1 normal line set:
This is fast fake FXAA (not FSAA). The idea is to produce factor for blending of a solid and blur edges
Set 2 normal line set:
A combine of a blur edge and a solid edge. Line is blurred and looked AA-ed
Set 3 normal line set:
Another iteration of set 2, this time it is Laplace filtered then blurred.
Set 4 normal line set:
The simplest set of them all, the building block of all the normal pass edge detection. Very lightweight.
Set 5 normal line set:
Heavy, uses fake FXAA then combined with blurred of the same edges. Since the edges are still colored, we separate them to RGB channel and condition them individually. Then we combine them into 1, producing very nice AA-ed edges.
Z depth line set (prior fix: version 1.0):
This convert Z depth to BU/Meter, the depth then converted to black and white values using color ramp. The value is repeated to avoid grey values from overstretching with extreme depth.
- Daniel Kreuter from Austria
- Lee Posey (The Jikz) from USA
- Bong Wee Kwong (Light BWK) from Malaysia
Active beta testers
- Metin Seven
- Dylan Ü
- Barkóczi Gergely
Please use and abuse this setup plus improve upon it!!