16
$\begingroup$

I'm using a charcoal image texture to make my cycles freestyle lines look as though they were drawn by hand with a pencil. My inspiration (and the source of the charcoal image texture) was the teapot file linked on this page https://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.71/Freestyle enter image description here

This is the charcoal image texture:

enter image description here

The concept works okay when you use multiple rounds to go over the same area a few times, but when I try to draw a single line it looks a bit crappy, with the repetitive nature of the texture very apparent.

Multiple rounds:

enter image description here

Single round (which is what I'm after, ideally):

enter image description here

I'm wondering if there's a secret to getting more realistic single stroke pencil texture lines in freestyle? Do I need a better texture? A more random way of having it repeat? Or something else? Hopefully things have moved on in the three years since that texture was created and used in the teapot model.

I've attached simple test file here: If for some reason the charcoal texture doesn't appear in the file, you can grab it from my post.

Thanks!

p.s. I'm aware of this question How can I use pencil style strokes in frestyle? but those answers simply point me towards the files I've already referenced.

Update May 29th 2017: Spurred on by Mr Zak's answer below I made another version with multiple rounds of lines and a little randomness. While I realize I can get close to what I want with this method (as the layering of the textures creates more randomness), I'm still interested to know if there's a way to improve the realism of the texture on a single stroke. But in the meantime here's what I achieved with multiple rounds and the settings I used. Perhaps it will prove useful to someone else.

Finished image:

enter image description here

Close up of one line:

enter image description here

Settings:

enter image description here

Update 2 May 29th 2017: Since someone asked, the project I'm working on is a series of line-based maps that I'm hoping to render as though they were drawn either in pencil or in pen. I'm still fiddling around trying to work out the final look and feel of them, but knowing if I can achieve the pencil or pen look is a part of that.

Here's an example of where I am so far:

enter image description here

As you can see the lines representing the terrain already have a good deal of randomness and wiggle in them, so that's why I was concentrating mostly on the texture of the stroke. It might be that the lines end up being too small to even register a texture, but as this is an ongoing discovery I wanted to understand the full extent of my options.

$\endgroup$
  • 1
    $\begingroup$ not an answer to the question, but to make the images part of the blend file you have to pack them. Use File>External Data>Pack all into blend and save the file. $\endgroup$ – cegaton May 27 '17 at 14:20
  • 1
    $\begingroup$ Thanks cegaton. I did try that before uploading the blend file, and thought it had worked, but I guess I got it wrong somehow. Also, thanks so much for adding the bounty! That was super kind of you :) $\endgroup$ – Dunstan May 28 '17 at 5:35
  • $\begingroup$ Maybe still related - blender.stackexchange.com/questions/31225/… $\endgroup$ – Mr Zak May 28 '17 at 23:16
8
+200
$\begingroup$

According to the wiki article Textured Strokes the Use Tips option is available when Along Strokes mapping is used:

Along Strokes Means that the texture will be drawn along the stroke length, making it possible to mimick pencil or brush marks.

However by default it won't really make any much difference:

screenshot-UseTips

The option depends on spacing between strokes mapped to the geometry:

Along Stroke mapping depends by the LineStyle spacing parameter that can be found in the linestyle settings. It sets how much the texture will be stretched along the stroke length. Higher spacing means less tiling.

It can be found in the same place where strokes are set up to use texture, Render Layers tab > Freestyle Linestyle rollout > Texture panel:

enter image description here

With that texture rendered strokes become more smeared:

screenshot-use-tips+spacing Spacing was set to 5

The effect however is still a bit off as its thickness is not varying and the stamp still is present.

From here on settings from the teapot file were used as reference as well

To correct that don't use thickness of 20; in fact less than 10 will be enough. For convincing and effective results better to let it draw with thin line and repeat it 2 or more times; that will simulate effect of graphite or a pencil strokes more nicely. This is the result wil Stroke effect decreaed to 6:

screenshot-thickness-lesss

Now some repeating pencil strokes would add a bit of "realism" to the image. With Repeat set to 3 it will be already more or less good. But to add even more to that in the Geometry panel add Spatial Noise modifier.

screenshot-thickness-low+spatial-noise

What the modifier does is it varies strokes created by the Repeat option. Amplitude option will increase or decrease how far away the repeated lines are from original; Scale adjusts the scale of repeated detail (if it was at 15 you'd get step-like corners around the line).

Smeared chalk like effect can be created with Along Stroke modifier added to the Thickness panel. According to the manual it applies gradient along each stroke while substituting original values of the line. To make lines more fat and smeared Use Tips option can also be unchecked (in this case):

screenshot-thickness-low+spatial-noise+along-stroke

The partially transparent effect from the teapot scene is created with adding Along Stroke modifier in the Alpha panel, but for some reason in Cycles it isn't visible (teapot scene is in Internal). Even setting Thickness to 0 doesn't really change anything, which is quite unexpected. It looks like in Cycles the freestyle won't calculate and hence use alpha of the charcoal texture. If making that in Internal effect shows up immediately:

screenshot-alpha-Blender-Internal

It's hard to say if this means for you that Freestyle went ahead since that time but anyway the resulting effect of the freestyle strokes can be changed quite drastically by editing options and adding modifiers.


If going with only one round of the stroke (and hence only one stroke drawn on the objects) you will need to alter it as much as possible in order to get varying style. You can use several line styles as already mentioned by @TK or you can go with more modifiers for one line style. I will use modifiers for Thickness panel mostly but possibilities are nearly endless as many of them have also additional modes of stroke overlaying which changes end result quite noticeable.

Note:

  • there aren't any modifiers on the line style for this one; none of the results used from the several rounds above.
  • in all the results here Face Smoothness in the Render Layers tab > Freestyle rollout is used for using smooth shading of the mesh. It also means that shading of the meshes should be set to smooth as well.
  • in all the results here Alpha Fac in the Line Style Output node in the line style setup is set to 0.5. This allows Cycles to overlay alpha of the texture and use it along with the base color. For some reason it also fixes usage of the modifiers in the Alpha panel. None of these is needed in Blender Internal.

Using stroke thickness (Freestyle Line Style > Thickness) at 3 and Spacing at 1 the result is thin drawing:

img 11

To increase the variation add Along Stroke modifier to the thickness of the stroke. It will apply new values for thickness based on the progression type and blending mode choosed; from the manual:

The Along Stroke modifier alters the base thickness with a new one from either a linear progression or a custom curve, mapped along each stroke’s length. In other words, it applies the selected progression along each stroke.

img_12

To mimic caligraphic changing of the line thickness which depends on the stroke angle add Caligraphy modifier. Its Orientation property will simullate orientaition of the virtual pen drawing on the paper - the more it's aligned with the vertical axis the more horizontal strokes will be fat and vertical - thin. Default values of 60 are quite good as well.

img_13

Also it's possible to add some noise to the stroke in general; Noise modifier will be the last in the Thickness panel.

img_14

To simulate transparency of the strokes modifiers in the Alpha panel are added. In this example Along Stroke modifier is used.

img_15

Note also that most of the modifiers can be set to another blending modes thus altering their final result which allows even more different things to try.

$\endgroup$
  • $\begingroup$ As a probably useful disclaimer the reason of existence of this answer wasn't just the bounty. $\endgroup$ – Mr Zak May 29 '17 at 18:00
  • $\begingroup$ Thanks so much for putting all that effort in, Mr Zak! It seems like my hope that there's something simple that can be done to make a single stroke texture look more randomly real isn't possible. I also found that multiple rounds of strokes helped cover up and randomize the texture a bit more, but I was hoping to be able to get away with just the one line. If you don't mind I'll leave this an unanswered for now in case anyone else has something to add. Thanks again! $\endgroup$ – Dunstan May 29 '17 at 18:15
  • $\begingroup$ @Dunstan that's totally ok to leave it unaccepted, I don't add answers for that.. What kind of strokes are you aiming for and what requirements do you have? I suggest including that in the question. If usigng 1 round you can easily get more or less good defined stroke by adding e.g. Bezier Curve modifier to Geometry and 3D Curvature to Thickness. It really depends on desired result and amount of time you're ready to spend. $\endgroup$ – Mr Zak May 29 '17 at 19:02
  • $\begingroup$ Thanks again for all your efforts on this. I really appreciate someone double-checking my work and adding in extra ideas. I've added an example of the kind of thing I'm working towards using this technique in. I think that unless someone comes along with a crazy idea out of the blue, your kind suggestions are is as close as we'll get. Many thanks again. $\endgroup$ – Dunstan May 30 '17 at 1:37
4
$\begingroup$

How about using 3 line sets instead 1 doing 3 sketchy repeats? For each of the 3 linesets you can specify almost the same line style settings but with minor differences that create desired randomness. Here's the result of my attempt based on the provided .blend file:

enter image description here

And here's a screen capture of the line style settings:

enter image description here

Summary of changes:

  • The 3 linesets and corresponding line styles are respectively named Base, Overlap #1 and #2 as shown in the screen capture.
  • In the latter two line styles, the Tip Remover modifier is used to shorten the lines for 2 and 4 unit lengths so that the charcoal texture starts with different offsets, making texture repeats less visible.
  • In addition, the Spacing Along Stroke in the Texture pane is set to different values in the 3 line styles (here 0.1, 0.2 and 0.3, respectively) to give texture repeats different stretching effects.
  • Since the 3 drawn lines overlap, the transparency of the 3 line styles are set to 0.5, while the Alpha Fac of the Line Style Output node is also set to 0.5, so as to make the textured strokes not too dense.

I hope this helps you better deal with uniform texture repeats.

$\endgroup$
  • $\begingroup$ Ah, very clever, thank you!. I feel a bit silly for not having thought of that :) $\endgroup$ – Dunstan May 31 '17 at 0:25
2
$\begingroup$

Most of the options are already well covered by Mr Zak and T.K.'s answers, but here's some more methods. The big issue with the textured stroke is that it basically gives you a dotted line of boxes that each hold the texture. But there can be splits or overlaps that cause problems, or gaps where strokes break.

Compositor

The most simple solution if you only want a single stroke is to use the freestyle lines as a mask to overlay a stack of textures in the compositor. This can be instead of using textures stroke, or in addition to it. For this, you will want a clean line set with thickness and alpha modifiers as Mr Zak describes, and then you will need a high frequency charcoal texture to overlay the whole image based on it. There are lots of potential ways to overlay it. Mixing several different textures together, and then varying them with cloud textures or something similar will probably get best results.

To help get your lines nice and clean, people usually put them through a blur, and then multiply the original lines on top of the blurred lines to feather the edges. They can also be put through filters like laplace and kirsch and then mixed back together to get a bit more variation.

Multiple Meshes and Line Catchers

While it probably isn't what you'll be after in this case, it is also viable to add more meshes or mesh pieces to catch lines. So instead of more rounds, or more linesets, you can have more meshes. This could be a simple curve in an area that you know needs to get a line, all the way up to an instanced version of the mesh on a separate layer that has a different amount of subsurf, smooth, or decimate.

A slightly different version of the mesh will mean you get a different chaining pattern. If you use multiple render layers off different versions of the mesh and combine then in the compositor, you can have quite a bit of control. (I doubt that will suit this particular project, but it may help others looking at this question.)

$\endgroup$
  • $\begingroup$ That's a super helpful extra solution. Thank you so much! $\endgroup$ – Dunstan May 31 '17 at 0:23
-3
$\begingroup$

Cick this button

Under "Texture Mask" tab, in UV Paint Mode, there is an option button called "Random", which rotates the brush randomly in strokes. You can set the max random rotation offset by changing the "360" degrees to whatever angel you want for strokes.

$\endgroup$
  • 4
    $\begingroup$ Please explain how this affects the cycles freestyle lines of the question. $\endgroup$ – Leander May 28 '17 at 20:53

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.