Cleaning up toon edges

I’ve been experimenting with creating cleaner toon edges and found a pretty simple solution using composite nodes that gives reasonable results.

180 eint Before

180 eint After

It’s not perfect but is a vast improvement for just a few nodes


As it works purely from the edge’s alpha channel, the end result is an image where black is no edge and white is an edge. So it’s a flexible starting point for messing with edges. I’m sure I’m going down a well travelled path here so if anyone has any tips on improving the setup, I’d love to hear them :eyebrowlift:

Thats very nice Domino, but i think this should go in the blender tests section, as its not really a “wip”.

Yeah, I see your point… Though it is a work in progress, just perhaps not the type that normally goes here :slight_smile:

common mistake :rolleyes:

That’s pretty interesting. I’ve tried various edge rendering techniques that use the compositor. I’ll be interested to try yours.

The one that I was trying most recently didn’t use the built in edge renderer at all, but instead looked at the difference between the normal pass and a blurred version of the normal pass.

That’s neat that you can take advantage of the existing edge renderer but still have much more control over over the end product than it usually gives.

I did some experiments with normals and couldn’t get consistant results that I liked. I was getting a lot more edge bleed causing fat lines and the line width was, somewhat variable…

I had a style in mind for my lines which this setup pretty much nails. It was figuring out that I could use the dilated edges to do a selective blur that helped simplify things. Before that I had a much more complicated setup that didn’t give as nice a result.

As this hasn’t been moved to the correct section, I’ve added my shader setup and some materials so it really is a “Monkey on a crate” WIP now :stuck_out_tongue:




The nodes are doing the majority of the work in defining the style, that’s why I’m working backwards in doing the composite node setup first, then I can model and do the materials to work well within that style.

One problem that has me scratching my head is handling transparent surfaces. Any one got a tip on how to get the edges to sit behind the glass panes?

The edges is a bit of a subtle effect, so I’m not sure that I’m seeing what you’re talking about. Is the problem that edges aren’t rendering when the edge is seen through the glass? Or that the glass doesn’t have any edges at all?

I can tell you that any material with ZTransp on it isn’t edged, and that RayTransp materials will be edged but will also block the edging of things behind them. If certain edges are hidden from the edge rendered I suppose you could use multiple render layers if we can’t come up with anything more elegant.

The glass is ZTransp but I’m not overly concerned about it’s edges. It’s the edge of the walls that runs behind the glass that shows the problem. The edge is a consistant size across 2 panes, 1 pane and no panes. So what I need is some way to fade an edge that is dependant on how many layers back it is.

Domino, your noodle is really neat. Thank you for this.

How about making another renderlayer set that renders only Ztra. The alpha channel of that layer would tell you how much glass you’re looking through, which could be a third input into your edge alpha clean group. You could take the Ztra alpha, color ramp it, and subtract it from your dilated edge alpha right before you run it into the size input on the blur node. This should shrink your edges based on how much glass they’re behind.

Got me on the right track. I was over thinking it too. The actual solution was far simpler. Add a renderlayer for Ztrans, turn off Ztrans on Main layer, mix Ztrans back in after edges have been added :slight_smile:

Had to add a little adjustment so the edges in front of the glass didn’t get reduced as well and this is what I ended up with:

Which gives nice control as I can use ZTrans for windows and ray trans for objects:

With the noodle pretty much sorted, it was time to test it with a moving scene. I ditched the shadow adjuster from the noodle as it only worked correctly with buffered shadows. This seems to be a current limitation of Blender as raytraced shadows aren’t 100% moved to a shadow pass. Apart from that the noodle used on this is the same as the last picture of them above.

This animation has buffered shadows on the title sequence and ray traced on the main part. And I gave the noodle a name :slight_smile:

Had to try one last application of the Instant Toon noodle before I considered it done. This time I wanted a more complex scene with detailed texturing, so I opened up the elevator shaft from Elephants Dream :slight_smile:

Due to the low lighting I had to adjust the color ramp to clamp less to black, apart from that, it’s the same setup as used for the animation.



I really like the results I’m getting now, so thanks to everyone who helped me get this done.

Here’s the noodle in a blend.