folkertdev / freestyle-svg-exporter

a Blender addon for exporting stylized lines created by the Freestyle render engine to an SVG format.
54 stars 18 forks source link

Fill contours is generated for every lineset #5

Closed xuv closed 9 years ago

xuv commented 9 years ago

Hello @folkertdev

It seems that there is a fill generated for every Lineset defined in Freestyle. And I'm not really sure this is intended behavior.

In this particular case where I'm trying to have external contour lines that are different from the inside lines, if I have the "Fill Contours" option enabled, it renders fills for both lineset and so it "hides" the fill of one lineset hides the lines from the other lineset.

Here are is a practical example. uhbench-debug-fillcontour

(Sorry, Github does not want me to upload SVG. So this is SVG rendered in PNG from Inkscape ;) ) I can send you the SVG files if you want them.

As I see it, for each lineset, the exporter creates a incorporating a for fills and a for strokes.

Maybe, if that's possible, it would be nice to (de-)activate the fill contours per lineset. Or just generate it once in it's own tag, that is always beneath all the other strokes.

Edit: Maybe a "quick hack" would be to compute the fills only on the first lineset and ignore for the following ones.

What do you think?

folkertdev commented 9 years ago

hello @xuv

the exporter is invoked by the parameter editor (which is really a large style module builder). This means that it indeed runs once per lineset.

Another important detail is that the fills use a completely new render process, i.e. they don't use the existing strokes but render/calculate new ones (that aren't visible, obviously).

Now, turning off the exporter on a per-lineset basis should be possible, but is a little involved. I'll have a look at it next week. As a quick fix, for now, you could play with the ordering of line sets (this should change which layer is on top) and maybe delete an obstructing fill layer in inkscape.

xuv commented 9 years ago

Hello @folkertdev

It's kind of great news to know that the fills use their own render process. Which means you can totally separate that from the number of linesets defined by the user and just calculate it once per render (and not per lineset).

It would have then it's own at the beginning of the file. And then a series of afterwards.

I'm also thinking that since it's independent from the linesets defined by the user, it would be great to just render the fills if this is requested.

So for example, if I just want to render a fill with no lines, I would just deactivate all linesets and just render with the option "Contour Fills" activated. It sound as something I would use.

As for now, I found a "hack" to solve my problem. I run a program called "XMLStarlet" over the rendered SVG to delete the that I don't want to keep. :)

Here's what the result looks like ;) uhbench

folkertdev commented 9 years ago

Hello Julien,

I'm very sorry this took so long, but I've finally fixed this issue.

The inclusion of both strokes and fills can now be configured for every line style. (due to technical reasons this can't be done per-lineset, even though that would seem more logical. I think though that the distinction doesn't really matter here.)

BTW, that gif is totally awesome

xuv commented 9 years ago

Hey.

Thx for the update. It's works beautifully. Thanks for taking the time to add this feature.