2
$\begingroup$

When I overlap 2 objects like this

enter image description here

resulting freestyle lines are like this

enter image description here

But I want render overlapped edge lines like this(red lines below picture)

enter image description here

What's the easiest way to accomplish my purpose?(A lot of objects in my work are made in that way so resulting render image misses many overlapped edges. I tried to remake some object to reveal overlapped edges but I realized that remaking all objects is too hard to me.)

$\endgroup$
  • 1
    $\begingroup$ It seems not possible: blender.stackexchange.com/questions/52526/… $\endgroup$ – lemon Aug 1 '19 at 8:21
  • $\begingroup$ thank you. but i'm really sad. $\endgroup$ – 나미손 Aug 1 '19 at 8:51
  • $\begingroup$ I've tried to do it with 2.8 using the Workbench engine. Not perfect but maybe have a look to it. $\endgroup$ – lemon Aug 1 '19 at 8:57
  • 1
    $\begingroup$ You may want to checkout LANPR which is currently in development as a possible freestyle replacement. $\endgroup$ – Robert Gützkow Aug 1 '19 at 9:37
  • $\begingroup$ Do you want face intersections, or hidden edges? $\endgroup$ – Robin Betts Aug 1 '19 at 10:17
3
$\begingroup$

This isn't possible (as far as I know) using freestyle. However, it is possible to fake the effect in the Compositor by looking for sharp changes to the rendered Normal and/or Depth.

To achieve this, we need to compare each point in the render with a neighboring point and highlight those areas where the Normal or the Depth varies by a significant amount between those points. This can be acieved with a node group as follows :

node group

Here we take the Depth and Normal as inputs and translate each by a specified X and Y (multiplied by the desired Thickness) - this allows the current pixel to be compared with a neighbouring pixel.

For the Normal, the RGB Subtract node compares them and the result is separated into its components and its overall magnitude calculated (as 'sqrt(r^2+g^2+b^2)'). If the result is greater than a Threshold we have found an edge.

Similarly, the Depth is subtracted from its neighbour and the Absolute result compared with a second Threshold. The two results are combined using the Maximum.

In order to avoid artifacts from features in particular directions, we can sample neighbouring pixels in different directions. This can be achieved with multiple node groups with different X and Y offsets - one above, one below, one to the left and one to the right (ie, (0,1), (0,-1), (-1,0), (1,0)) and the results combined as follows :

nodes

This can produce the following results (after tweaking the line thickness and thresholds) :

result freestyle

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.