Author Topic: Inkscape gradient mesh test  (Read 5316 times)

December 24, 2016, 03:40:30 AM
Read 5316 times

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
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.

leaf133704776.jpg
*leaf133704776.jpg
(34.55 kB . 409x470)
(viewed 599 times)

gmtest-leaf1.png
*gmtest-leaf1.png
(100.31 kB . 351x416)
(viewed 598 times)

gmtest-leaf.svg
*gmtest-leaf.svg
(619.38 kB - downloaded 534 times)


« Last Edit: December 24, 2016, 10:26:12 PM by brynn, Reason: Edit #2 - tweaked the title, potentially for better internet search results »
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

December 24, 2016, 03:49:36 AM
Reply #1

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
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.
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

December 24, 2016, 05:20:23 AM
Reply #2

Lazur

  • IC Mentor

  • Offline
  • ******
  • Inkscape Filters Wizard

  • 1,154
  • Gender
    Male

    Male
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.

The petiole is looking pretty good.

December 24, 2016, 06:47:38 AM
Reply #3

Lazur

  • IC Mentor

  • Offline
  • ******
  • Inkscape Filters Wizard

  • 1,154
  • Gender
    Male

    Male
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:

December 24, 2016, 03:19:06 PM
Reply #4

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
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.)

gmtest-leaf2.png
*gmtest-leaf2.png
(170.58 kB . 376x440)
(viewed 581 times)

gmtest-leaf.svg
*gmtest-leaf.svg
(2894.99 kB - downloaded 525 times)
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

December 24, 2016, 03:49:05 PM
Reply #5

Lazur

  • IC Mentor

  • Offline
  • ******
  • Inkscape Filters Wizard

  • 1,154
  • Gender
    Male

    Male
I was thinking of Voronoi as a filter primitive, if it existed.
Like these are similar procedural textures to the svg's turbulence filter primitive.

Nevertheless it came out nice!

December 24, 2016, 10:23:04 PM
Reply #6

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
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!
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

December 24, 2016, 10:34:42 PM
Reply #7

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
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  :)
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

December 25, 2016, 12:09:03 AM
Reply #8

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
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, including SVG and CC-BY-SA license, so people can look how I used the gradient mesh.

  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

December 25, 2016, 09:22:09 AM
Reply #9

Moini

  • IC Mentor

  • Offline
  • ******

  • 1,568
    • VektorRascheln
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...

December 27, 2016, 03:32:16 PM
Reply #10

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
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.
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann