8
$\begingroup$

(My english isn't very good, do not hesitate to edit my question)

I'm currently searching the best way to draw some 2D filled shape using Blender.

For example:

enter image description here

This image is a render from Freestyle, the variable stroke width is automatically generated which isn't what I want.

For the moment, I've found some interesting methods. One of them consists to play with a Bezier Curve in 3D mode that is extruded a little bit (with Tilt at 90°) then I can use ALT+S for change the radius of my extrusion. I really like that way of working and it give me that kind of result which is good:

enter image description here enter image description here

The Problem is that I can't easily fill the shapes... Lets see with this example: enter image description here

If I want to fill that shape, I need to:

  1. Duplicate my Bezier curve
  2. Change the Z position of the duplicated curve to put it behind the original shape.
  3. Change its mode to 2D so as fill it.
  4. And finally, change its material to the color I want.

enter image description here

That's a bit annoying to do and when there is a lot of elements on my stage, it becomes a mess, even using Groups.

It would be easier to use Freestyle for that, but how could I control manually the thickness of the stroke like I do with those bezier curve when I'm changing the Radius ? Does a similar way exists (like weight for example) ?

I searched for a modifier of Freestyle Lineset but no luck. I've saw that it is possible to use Python, do you think it is possible to use that mode ? I tried a few, but the data input don't seems aware of a parameter like the Radius of the vertex...

$\endgroup$
  • $\begingroup$ You don't have to tilt your curve nor make it 3D, just use a flat bevel object as described $\endgroup$ – Duarte Farrajota Ramos Sep 24 '18 at 18:05
  • $\begingroup$ Possible duplicate of Planar curve with width $\endgroup$ – Duarte Farrajota Ramos Sep 24 '18 at 18:06
  • $\begingroup$ @DuarteFarrajotaRamos The example you show in your answer don't seems to provide a way to have a variable stroke width around the path :/ I'm wrong ? also it seems even less convenient to use, I rather prefer to use my curve solution. But by the way, the object of my question is to control manually the stroke width of the FreeStyle render, by, for example, changing the weight or the radius of a bezier, that would be neat ! $\endgroup$ – snoob dogg Sep 24 '18 at 22:19
  • $\begingroup$ Why not? What happens when you use curve radius? $\endgroup$ – Duarte Farrajota Ramos Sep 24 '18 at 22:25
  • $\begingroup$ Ok, it is possible to have a variable stroke width I get it but in that case I cant have a filled shape. You understand my problem ? I want filled shape with a color with a border having a different color and a variable stroke width $\endgroup$ – snoob dogg Sep 24 '18 at 23:50
4
+50
$\begingroup$

Animation Nodes can be used here. Essentially, if you add a 2D curve and copy the 3D spline to it using this simple node tree, you will get what you need:

Node Tree

It also works for multiple splines:

Node Tree

But what if we have multiple spline objects? In this case we append all splines from all objects into a single list and use it instead, and the 3D spline objects can be sourced from a blender object group that the user will add:

Node Tree

What if we want the fill objects(2D Curves) to be separate objects so that we can add different materials for instance. In this case, the 2D curves can be dynamically generated using the Instancer Node:

Node Tree

$\endgroup$
  • $\begingroup$ Cracked it! :D.. I feel I should delete my answer, since it missed the point of the OP.. $\endgroup$ – Robin Betts Sep 29 '18 at 13:21
  • $\begingroup$ @RobinBetts I never knew freestyle could do that, so your answer taught me something new. Better leave the answer anyway. $\endgroup$ – Omar Emara Sep 29 '18 at 15:17
  • $\begingroup$ wow , it really looks like the answer I'm seeking for, but don't know the animation nodes, never heard about it, it is blender vanilla or an addon ? $\endgroup$ – snoob dogg Sep 29 '18 at 19:20
  • $\begingroup$ @snoobdogg It is an addon, see What is Animation Nodes? $\endgroup$ – Omar Emara Sep 29 '18 at 20:00
  • $\begingroup$ ok I was able to recreate your firsts programs and it work like a charm, I've just an hardtime with your Loop with Invoke Subprogram. I can find 'Create Spline List' but not 'Spline List'. Also I didn't found the iterator you use for have Source / Target. $\endgroup$ – snoob dogg Sep 29 '18 at 23:06
3
$\begingroup$

There is a modifier in Freestyle which will let you do this:

in the Freestyle Line Style for your current line set, select 'Thickness' and assign an 'Along Stroke' modifier.

In the modifier, set the mapping to 'Curve', and , probably, the blend method of the modifier to 'Multiply' of some base thickness value of your stroke.

enter image description here

You can now click on the curve to create control points you can manipulate by dragging, to control the thickness of the stroke along its length.

It's easier to do this in the Blender Internal renderer, where you can see the stroke reasonably interactively in the Rendered mode of the 3D View. There's nothing to stop you switching to Cycles when you have your strokes set.

There is (in my system, at least,) an annoyance: sometimes the drop-down menu from the spanner icon on the graph disappears before you can select one of its items. My get-around is to ShiftZ in and out of rendered mode .. there seems to be a contest for focus.

$\endgroup$
  • $\begingroup$ Thank you, that's what I already do in the first image of my question. For me that's not ideal at all because it's hard to control the points and because that modifier will be applied to each shape, right ? In fact, appart improve Freestyle with a modifier able to take Radius into account with 2D Bezier Curve, I fear there isn't good solutions to my question $\endgroup$ – snoob dogg Sep 27 '18 at 17:19
  • $\begingroup$ Sorry, I didn't gather you were using this from the OP. The modifier is applied to the line set, so you can have a line set for each shape, with different profiles... but yes, it's not the friendliest tool in the world.. $\endgroup$ – Robin Betts Sep 27 '18 at 17:30
  • $\begingroup$ for the moment I combine the Bezier curve technic with freestyle, that's the best solution I've found but it is not very ideal.. $\endgroup$ – snoob dogg Sep 27 '18 at 20:20

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.