How to create a curve of object silhouette with geometry nodes?

I want to be able to produce a curve that follows the outside silhouette of an object from the POV of a camera, similar to the outline that appears when you select an object.


Another example would be the contour option in the lineart modifier.

What’s the best way to go about this? I would ideally like it to be as efficient as possible since this will be the basis for another effect I want to make.

Hello ! You can look for an artist called Tradigital who produced a tutorial and some paid assets about doing painterly effects with blender and geometry nodes.
One of the key elements of their method is to make an outline and use that to drive the paint strokes…

The method to extract the contour is basically by comparing the normal of the object and the direction from the camera, basically using a dot product.

Then you can remove all the faces that point in the opposite direction of the camera, like a backface culling, and eventually you keep only the outline of the resulting mesh…

Have fun !

2 Likes

Perfect, thank you!

1 Like

Sorry I think I was a bit hasty marking this as a solution. I’ve actually tried it out now, and while it is definitely useful, it’s not exactly the result i need for my project.

This is what I ended up with after following a section of the nodes in his “Turning 3D Models into Masterpieces: A Blender Tutorial” video:

Maybe I just need to edit some more values, but this doesn’t give me a clean silhouette line, it also gives contour lines along some of the other sharp edges of the mesh, not just the absolute edge.

Additionally, the edge is jagged since it zigzags round the edges of the faces, similar to the grease pencil lineart modifier. You can reduce this by increasing the resolution of the base mesh, but that obviously makes it laggier, and it doesn’t completely remove the issue.

I want to be able to project the curve onto a flat plane and then use Fill Curve to combine it with other curves, so I need it to be continuous, smooth, and flat (or able to be flattened), and ideally with as few points as possible.

Is there a way to create a flat curve from the silhouette of an object, or alternatively a way to clean up the node setup above to achieve the same result?

well , if you want the contour line to be in 3D like the lineart modifier then this is the closest solution. Maybe it’s possible to do a remesh to cleanup the model before extracting the countour, and remove some of the artifacts , I must admit that I didn’t played a lot with that anyway…

Another approach is to create a very dense plane in front of the camera and raycast it’s point in the opposite direction of the camera and see if they hit the object, a bit like a raytracer. Then you can extract the contour of that.
It will fix some issues you’re currently having but you’ll need a very dense plane, or you’ll have to smooth the edges in some way or another…

That’s the two approach I know and I’m not sure that there could be a lot more. The first one is mimicking the lineart modifier so it’s safe to assume that it’s the best algorithm available.
The second method is more a 2D approach. Some 2D post process on actual renders might offers a lot more possibilities but we are obviously limited when trying to implement them in the viewport in a kind of 2D/3D approach…

I’d be very curious to know if there is another way that we can use in GN !

Good luck !

3 Likes