1
$\begingroup$

It seems to me the freestyle visibility computation is erroneous. I am getting lines where they should not be visible.

This is the scene I am trying to add freestyle lines to:

scene view

This is the result including freestyle lines:

scene with freestyle lines

As you can see, it seems you can partially see through some of the geometry - for example the axis on the right side. On the other hand, some lines seem to be missing as on two of the screws. To clarify, this is what's wrong with it:

freestyle errors marked

The freestyle settings are pretty common ones - you can't even adjust anything regarding the visibility.

freestyle settings

I need to get rid of these artifacts. My guess is that I am missing precision somewhere - I tried adjusting the camera near and far limits, for example. I also searched for a way to set the depth resolution. If there is such a thing, I didn't find it. The result is the same for Eevee and Cycles, by the way. It also does not seem possible to composite the image by myself, as the new Freestyle Render Pass (new in 2.83.1) does not have a Z Buffer I could use to merge it to the rest of the image.

$\endgroup$
  • 2
    $\begingroup$ I guess we would need to see your Line Set selection methods.. and maybe a minimal example of an undesired result, along with a description of the desired result. There are a lot of variables here, making it hard to give a definitive answer. You could even share the example on blend-exchange.giantcowfilms.com $\endgroup$ – Robin Betts Jun 29 at 8:53
  • $\begingroup$ Freestyle doesn't work with intersecting/overlapping geometry. $\endgroup$ – Leander Jul 6 at 15:25
2
$\begingroup$

As far as I can see, you do have a loss of precision .. due to the topology of your model.

  • Your model has many, many duplicate vertices.. they have to go first.(M Merge > By Distance)
  • But even then, the topology is very extreme, in places. The only fixed data-points the renderer has to work with are vertex locations. The rest is interpolation - of normals, shading-point locations, everything. If a rendered polygon is a very long thin triangle, then you're running into interpolation inaccuracies near its center.

Flat surfaces are OK, interpolating between a value and itself doesn't present a problem.

As a quick hack, subdividing the surface of the long shafts restored their opacity to Freestyle, but a repair of the topology would make a better job of it. You might get away with replacing the shafts with dimensioned, quad-based cylinders, with a few subdivisions of their length.

Raising the nuts so their bottom edges are at/slightly above the plate they are screwed down onto, makes them visible to Freestyle without changing the edge selection settings. (Some are buried at the moment)

Introducing per-face-vertex normals, by switching 'Autosmooth' on, with appropriate, (quite high for these elements,) threshold angles, will help keep smooth shading without overdoing the poly-count.

| improve this answer | |
$\endgroup$
  • $\begingroup$ Since this is just a step in an automated pipeline, I do have very limited control over the input mesh. The Subdivision Modifier seems to help as a first step. However, it would be a better approach to use some kind of Beautify Modifier, to only subdivide the mesh where absolutely necessary. $\endgroup$ – A. Tropics Jul 17 at 10:25
  • $\begingroup$ I'm sure there will be ways to automate the cleanup. I guess the best chance of good answers would come from posting that as a new question. $\endgroup$ – Robin Betts Jul 17 at 10:37

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.