Inkscape Community

Skills, Challenges & Artwork => Work In Progress => Topic started by: brynn on December 24, 2016, 03:40:30 AM

Title: Inkscape gradient mesh test
Post by: brynn on December 24, 2016, 03:40:30 AM
Hi Friends,
I'm almost finished with a test of the new gradient mesh tool.  Except for a lot of minor tweaking, the main 2 meshes are finished.  I just need to add some kind of texture.  And I might need to add a couple of blurred shapes here and there, where I can't make the mesh work like I want.

Attached are the photo I used as a model, and the SVG.  I'm not trying to make it photorealistic, or perfectly look like the photo.  But still something that looks realistically like a leaf.

Edit
Since Firefox is not displaying the mesh in the SVG image, I'm attaching a PNG, to show what it looks like.

 [ You are not allowed to view attachments ]
 [ You are not allowed to view attachments ]
 [ You are not allowed to view attachments ]

Title: Re: gradient mesh test
Post by: brynn on December 24, 2016, 03:49:36 AM
Hhmm....it looks like Firefox can't display all of the image.  For me, I see the veins of the leaf, which does have a mesh applied to it.  But the main leaf isn't showing for me.  Do you all see it?

I'll upload a PNG, so everyone can see it.

Edit
Well, in the SVG, the veins have a mesh applied, but the mesh colors aren't showing in Firefox.  Weird that it doesn't display the rest of the leaf, because they both have meshes.
Title: Re: gradient mesh test
Post by: Lazur on December 24, 2016, 05:20:23 AM
Meshes are not part of the svg specs, that's why firefox doesn't render it.
The whole point of this new feature is to push it into svg 2.0.
As it was announced here (http://www.inkscapeforum.com/viewtopic.php?f=21&t=31148).

The petiole is looking pretty good.
Title: Re: gradient mesh test
Post by: Lazur on December 24, 2016, 06:47:38 AM
Filtering a realistic texture is limited to the turbulence primitive. Like a giraffe skin pattern a voronoi fractal would be much better to construct it from but that's not part of the specs either.

Anyway, had given it a try:
Title: Re: gradient mesh test
Post by: brynn on December 24, 2016, 03:19:06 PM
Oh, voronoi pattern was the first thing I tried.  But I haven't learned how to make filters yet.  So it doesn't really do much.

I can open your file barely, and I can open the filters editor.  But when I click on anything in the filters editor, it takes forever for Inkscape to answer the click.  It's probably very close to crashing.

But it looks really good!

Here's my best effort.  I used the Voronoi pattern, and somehow (not sure how) managed to use 2 different layer blend options on 2 different copies of the pattern.  Note that when you move an object from a blended layer, to a non-blended layer, it turns into a filter made with the blend primitive.

As long as you don't zoom in, it looks ok to me.  But as soon as you zoom in, you see all sorts of ugly things!  I added a little drop shadow, to give it a little more life.

(Moini, I'm not sure where you were looking to put an example, but you're welcome to use this.  I could upload to my server, separate from the forum attachment, if necessary.  Maybe you already found enough examples, but just in case.)

 [ You are not allowed to view attachments ]
 [ You are not allowed to view attachments ]
Title: Re: gradient mesh test
Post by: Lazur on December 24, 2016, 03:49:05 PM
I was thinking of Voronoi as a filter primitive, if it existed.
Like these (http://www.neilblevins.com/cg_education/procedural_noise/procedural_noise.html) are similar procedural textures to the svg's turbulence filter primitive.

Nevertheless it came out nice!
Title: Re: gradient mesh test
Post by: brynn on December 24, 2016, 10:23:04 PM
Thanks Lazur!

Yes, I did follow your thinking about using the voronoi pattern like turbulence, as part of a filter.  I just haven't had a chance to read Tav's tutorials, and learn how to make custom filters yet.  Plus, Inkscape doesn't have such a thing, does it?  Might be nice feature request!

I'm pretty happy about how it came out.  Of course if you zoom in to the svg, it gets ugly pretty fast.  While with using filters, zooming doesn't show those things, as much.  But at face value, I'm satisfied.

The biggest lesson I learned about the gradient mesh, is that you can spend all day tweaking the node/stop colors.  After a certain point, you just have to call it good enough.  I was expecting it to be much easier than it turned out to be.  But maybe with some experience, it will become easier. 

I was surprised that it can't provide nearly as much detail as I was expecting.  It looks like you can't get any more than 20 lines and column of nodes/stops.  For a small object, yes, you could get a lot of details.  But for even a medium sized object as this leaf, I was wanting more.

I used 20 x 20 in the main leaf color.  Because there's thin, dark outline in the photo, I used a stroke object, but only 12 x 12 on that mesh.  Probably I could have tweaked that one a little better.  I don't remember if it was 12 or 20 for the veins, but the veins have a mesh too.  And the stem (petiole) too (something like 4 x 10).  Probably could have tweaked it a little better too.

I was also surprised that I didn't run into more performance issues.  I think comparing the gradient mesh, to my usual reaslism style (many small, blurred objects), I don't have nearly as much trouble with slowing and crashing.  I really only ran into trouble when I added the voronoi pattern, which I converted to paths.....maybe didn't need to convert to paths???  And especially after I duplicated it. Just those 2 objects added a MB to the file!
Title: Re: Inkscape gradient mesh test
Post by: brynn on December 24, 2016, 10:34:42 PM
Hhm, in final thoughts, I think it might be improved with some slight shininess to the leaf.  Something similar to specular light, but not quite so bold.  I'm still learning how to make things look shiny.  I think I'm very good at making depth with matte texture.  But shiny, I'm still learning, and I haven't found the key yet.

 :idea2:  Maybe I could import the PNG, and practice making shiny.  Because otherwise, the file is having too many performance problems, to do any more serious work on it.  Hhm, not sure if that might be better to use the mesh to put those effect in....maybe a 2nd mesh on top??

Well, if I come up with something halfway decent, I'll post results  :)
Title: Re: Inkscape gradient mesh test
Post by: brynn on December 25, 2016, 12:09:03 AM
Well, I ended up tweaking the drop shadow - made it lighter - then that made the dark outline too prominent.  So after I tweaked that mesh a bit (taking 30 sec for each click, at this point  :@@: ) I exported a new PNG.

I like the shadow much better now.  Uploaded to gallery (http://inkscapecommunity.com/ic_gallery/displayimage.php?album=7&pid=540#top_display_media), including SVG and CC-BY-SA license, so people can look how I used the gradient mesh.

Title: Re: Inkscape gradient mesh test
Post by: Moini on December 25, 2016, 09:22:09 AM
I like very much how it turned out, Brynn.

I'm not sure about the original from shutterstock - would this re-drawing pose a licence problem?... Maybe next time, use something from pixabay, those are all Public Domain. Then any tricky licence questions can be avoided... I don't want to take on responsibility for any possible licence infringements, else I'd have put it into the Wiki by now...
Title: Re: Inkscape gradient mesh test
Post by: brynn on December 27, 2016, 03:32:16 PM
Well, you know, I'm always the first one to shout about protecting copyrights.  But in this case, I don't think it's a problem.  I never would have used it, if I thought there might be a problem.

If I were attempting photorealism, I would be careful to use my own image, or a PD image, or purchase a license.  But since I just used it as a guide or model, I don't think there's any violation.