Grease pencil and freestyle (-ish)

Hello,

I hope I’m not posting in the wrong place ^^.

TL;DR: Is there a way to make freestyle stop drawing lines over grease pencil objects ?
If not, are there equivalent solutions as “freestyle” to render sketchy lineart?

I’m trying to figure out how to make a sketchy styled 3D environnement, with a lineart, and integrate grease pencil object in it. Freestyle allows to render great linearts, but it just completly ignore grease pencil objects.

Here’s what I’ve tried:

  1. Replacing freestyle with other techniques.
    -> Solidify modifier and inverted normals renders boring “lineart” (well, maybe it just illustrate the difference between “outline” and “lineart”), with little to no customization options, or tedious ones (with weight paint). It renders unconsistent line thickness, which break the “sketchy” feeling. Since it duplicates the mesh, I’m not sure it is an optimized solution.

  2. Replacing freestyle with various shaders.
    -> Usually, line thickness is related to the distance of the camera. They might give a “sketchy” feeling for a single character, or a single object, but for a whole scene, it just doesn’t work.

  3. Replacing freestyle with shader AND using an orthographic camera.
    -> Line thickness is consistent, like that. But an orthographic camera is not appropriate for what I intend to do.

  4. Rendering picture as a background, then adding grease pencil.
    -> This is a real waste of potential. The advantages and flexibiolity of the 3D environnement are lost. Moreover, it implies to render a rendered picture, which therefore, lowers the quality of the pictures.

  5. Cutting rendered object in pieces and put them together like billboard objects in a new scene.
    -> It is a tedious process, and it has the same disavantage as the “solution” mentionned above. But it add the fact that line thicknes is, once again, inconsistent.

  6. LANPR.
    -> Just too unstable at the moment for a real project.

Attempt in progress:

  1. A modifier setup that would turn the alpha (or thickness) of the freestyle lines to 0 if detected to be behind the grease pencil materials (or something that would implie the existence of the drawing in grease pencil)
  2. A compositing setup? (Although, I’m pretty sure it is mechanicaly impossible this way)

And that’s about it. I have to admit, I’m running short of ideas. So, if you have any idea, I would be very glad to hear it.

Thank you.

Hi, I decided to try some stuff in the compositor, and I found a simple solution for this. Try creating another view layer that just has your grease pencil objects and combine them with the z combine node in the compositor:


I had to render the scene with a transparent background then composite it back in using the environment pass because I got some of the background color around the edges of the grease pencil objects when the background was opaque:

Here’s the blend file I used if you want to look at it:
test.blend (1.5 MB)

3 Likes

Awesome solution!

I would add, it’s even working with Eevee. To do that, since there’s no environment pass yet in eevee, instead of linking “Env” to “image”, link “image” (from the render layer of the “freestyled” scenery) to “image” from the “alpha over” node. No artifacts, no line over the grease pencil. Thank you @zanzio!

1 Like

Bro, that is sooooo easy! Thank you! :slight_smile:

Nice work!

OMG Thanksss you are GOD <3