3D tree material tutorial - Leaves

20091109 finaltree

A tutorial on making leaf materials for 3d trees, in this case a sugar maple (in autumn).

20091109 grey_noopacity

Firstly, some observations on opacity mapped leaves vs. geometry leaves. As you can see in the image above, the images in this post were made using opacity mapped leaves. After some tests on my farnsworth house project, I have come to the conclusion that it is quicker in most cases to use opacity mapped leaves. Its true that in simple scenes trees with geometry leaves may render quicker as VRay doesnt have to calculate the opacity of thousands of leaves, but in dealing with complex scenes with millions of polygons the advantage in using (a lot) less RAM is huge. The processes involved in swapping opacity mapped plates for geometry are also very long winded and very tedious!

Exporting from Onyxtree. I went with 4 polygons per leaf so that the leaves aren’t just flat. Remember to set the dimensions you want the individual leaves, and change the units when you export. You can also make it export 3 different leaf IDs with varying sizes. I normally export as a .obj file.

onyxtree

Opacity mapping. It’s important to make sure the opacity map is just pure black or white, with a sharp edge. The opacity map I used can be found here (its not a great example!). You should also turn off filtering in the bitmap loader options (screenshot).

20091109 grey
As imported to 3dsmax and given grey materials.

VRay2sidedMtl. The vray 2 sided material works best with geometry that has no thickness, which is what onyxtree outputs. It is a very quick way of generating a SSS (sub-surface scattering, think candle wax, skin, milk etc) type look. The image below is rendered using a vray2sidedmtl on all leaves with grey submaterials and a hand drawn image for the vein skeleton.

20091109 grey_transparency

2sided

Front material. The front side material is a basic vraymaterial with a diffuse map and a reflection map. Click here for front vray material set up. The color correction map is to produce slightly different hues of leaf for each of the 3 sub leaf types (you should have got a mult-subobject material when you imported the .obj file). I usually make the first leaf and then copy and paste it to the 2nd and 3rd and just change the hue value slightly. The diffuse map looks like this, and the reflection map is a b&w copy with levels adjusted to make it more contrasty.

20091109 no_2sided
Render showing front leaf material on both sides with no transparency.

Back material. The back material is a copy of the front material but with a different diffuse bitmap and not quite as reflective. Note that I overlaid the veins skeleton jpg on top in photoshop as well. (without it, the veins looked too light when viewed from the underside as they took 100% of the lighter back material)

20091109 no_transparency
Render showing 2sided material with correct front/back materials but no transparency.

Finished result Click image for 800px version. Rendered using vrayphysicalsky and sun, and a vrayphysicalcamera.

20091109 finaltree

Tags: , , , ,

Comments

  1. Thanks for another nice tutorial!

  2. Great tutorial Peter!

    The fact you find opacity performs better in large scenes is something new for me, I was sure opacity is the bottle neck in this types of renderings.

    The final shot looks amazing, so vivid and real looking! (minus some of the floating going on there, i guess a twig layer was off or something)

  3. Just found this tutorial through Ronen’s twitter!

    Totally agree, i could have mistook the final render for a photo - great stuff!

  4. Thanks Peter - Much appricated. Best Tutorial on leaves that I have seen.

  5. good one.

    though i personally had more trouble getting the branches and the trunk right - including good bark as well as desired leaf distribution.

    thanks :)

  6. ¨This is so cool Peter ! As you know, I am crawling the web for references about making opacity / mesh leaves and your tutorial comes at the right moment ! We are about to make some windy trees footage to in animation, I’ll post some example if it turns out to be good !

  7. thanks peter, very useful!

  8. wayne parker

    hey Peter, Just amazing man! really excellent stuff! I must please bug you for your render settings if you don’t mind! i took your advice re rendering settings in general but would like to (if you can excuse the following word) copy these settings to see where i’m going wrong. it would be much appreciated. still loving the noise! :-)

  9. Beautiful looking leaves. Thanks Peter. This is obviously a great technique!

  10. Hehe nice! Great you took some time to look so deeply into this.
    I’m in the middle of some tight-deadline-work, but I’ll go through it tomorrow. :)

  11. Daidaloos

    Hey Peter, thanks alot, this is super-helpful tutorial! A part 2 with further instructions for branches would be 2 times excellent! Thanks!

  12. Austin Hernandez

    Great tutorial. I too found that opacity on leaf plates does render well even for large scenes. making sure there is no grey on your opacity map and turning off filtering is huge. also make sure the vray blur value is low enough as to not create grey in your opacity map is a must. too low and it will dance in animation though. there is a sweet spot of .3 to .5 i have found.

    Gorgeous render BTW. I was commenting to my coworkers on how great your trees looked in the farnsworth house project.

  13. Adam Hotovy

    very useful information, thank you for sharing your knowledge

  14. Thanks all, and thanks for the various tips!

  15. flashonja

    Thank you!

  16. Alright. Now I’ve given this a good deal of thought, and done sort of a theoretical mock-up of how it should work.

    First of all, we need to look at how leaves actually work.
    • If a leaf is lit from the front, and viewed from the front, all you see is the “front material” (full diffuse color, speculars and reflections).
    • If we turn the leaf over, and look at the backside of it, all you see is the “back material” (which usually is more pale, and more matte).
    • If we turn the view around, and see the leaf from the back, but lit from behind, more of the front material comes through (typical SSS effect).
    • If a shadow hits the leaf, the shaded part does not have that SSS effect, but instead shows the full back material (assuming we have some environmental lighting).

    Can we all agree to that? Fine. :)

    Now, I did a little mockup where I got a decent result. It also shows where the normal 2sided material fails. The scene has one vray light and some simple environment lighting. Check my photo stream at flickr http://www.flickr.com/photos/30753386@N03/
    My scene here is not the ultimate solution - just a start to see if it was possible to do somehting in this manner.

    I could be out on a limb completely here (pun unintended), but it would be great if we could come to a final solution for creating leaves in Vray. Ideally, I’d like two translucency slots in the 2sided material. That’d make life much easier. Vlado?

  17. What does the (falloff) mean in you examples? Using a falloff map in shadow/light mode in this case will not get you correct results. Other than that the vray2sided material should give you exactly what you have stated.

    Best regards,
    Vlado

  18. I’m searching for perfect leaf material for ages, and here it is. Great stuff, and thanks for sharing your knowledge.

  19. To clarify what I mean, I did some new renders with a leaf material. The front material is a clearly green material with some reflection, whereas the back material is pale, with hardly any reflection. Just as you’d see in an aspen leaf.

    The 2sided-leaf-front-(0-transparency) shows the desired front result - no blending of the front and back material. http://farm3.static.flickr.com/2649/4098182562_203f0eb411_o.jpg
    The 2sided-leaf-back-(0-transparency) shows that same leaf from behind - no transparency, so this won’t really do it.
    http://farm3.static.flickr.com/2788/4097427163_2caeed3638_o.jpg

    I increase the transparency to 128 gray, and get these results.

    2sided-leaf-front-(128-transparency) shows how the front material is much paler, and not as vibrant as the first version.
    http://farm3.static.flickr.com/2780/4097427109_5cf8160474_o.jpg
    2sided-leaf-back-(128-transparency) is that leaf from behind. Since the front material shows through, it’s got a lot more of the bright green from the front material - also in the parts which are hit by the shadow.
    http://farm3.static.flickr.com/2538/4098182672_0cc28339eb_o.jpg

    Using the shadow/light falloff material, it looks like this.
    From the front, in 2sided-leaf-front-(falloff) I get almost the exact same result as the first example image.
    http://farm3.static.flickr.com/2495/4097427139_dc0ea16763_o.jpg
    The backside, 2sided-leaf-back-(falloff), keeps the pale and matte look of the material, but it still has a decent SSS effect.
    http://farm3.static.flickr.com/2578/4097427183_4536d61639_o.jpg

    But like I said, this setup is far from optimal. Using the light/shadow falloff isn’t the best way to go - for instance you need to adapt its RGB output (to roughly 0.005) if you’re working in physical light scale. Also render times increase quite a bit.
    What would be great is a 2sided material, which treats the blending of the materials different. It works great when you have the same material as front and back, butproblem starts when you’ve got different materials.

    Ideally, I’d like a material which only adds light (in the correct color) from the brighter side of the material. Nothing else.

    But for now I’ll totally stick with the setup in Peter’s tutorial - render times for my light/shadow based material are just too long. Oh, and sorry for hijacking your blog, Peter. ;)

  20. great material. very realistic

  21. Damn it Mats, and I was quite happy with this method as well….

    Well the good news for you is that you aren’t going crazy! I see what you mean now, but I don’t know the answer. For some reason the vray2sidedmtl appears translucent when you wouldnt expect it to. I suspect its all sensitive to relative light levels, but I found by lowering the output amount of my translucency bitmap I got it looking a bit more like I would expect it to.

    This test scene has one vray light and no environment lighting.

    2sided copy
    Click for legible version

  22. Haha thanks Peter! Good to know you think I’m not crazy. (I WAS starting to wonder.)

    If I’m using the normal 2sided material approach, I think there’s an acceptable amount of blending and SSS somewhere around 96 gray. That’s what I’ve been using so far.

    However, I’d love to see a material that worked flawlessly. I’m thinking it should be quite easy to program.
    The transparency factor could be ignored alltogether. You basicly never want to see a blend between front and back material. What you want to take into account is the differance in lighting between the front and the back.
    If the front material is more brightly lit than the back material (I’m talking viewing front/back here), there should be no blending. If the back material is lit brighter, the difference in brightness should be added to the front material.
    Also, I think there should be a slot for the SSS color, instead of using the front/back material diffuse color. Since a leaf’s translucency color is mostly due to the green chlorophyll, it should be easier just having to set the desired SSS color, than having to take the diffuse colors of the individual materials into account.

    I can make a sketch tomorrow, if you find my reasoning unclear. :)

  23. Hi Peter, one more among your other great tutorials:) tnx, learnd alot from you:)

    One observation if you don’t mind:)

    Isn’t more convenient to save a tree in onyx as parametric model, then when you import it in max, through treestorm plugin, you can still make some tweeks and take advantage of random seed option and treestorm proxy.

    Thaks again for sharing your knowledge.

  24. bruno de sousa

    Fantastic research work.
    Thanks for sharing!

  25. nik, yes, defintely. I don’t own treestorm though. Is the latest release stable enough?

  26. I ran in some stability issues when moving adjustment sliders in leaf plates section of plugin, resulting in “3ds max stop responding” message. Later on I realized it’s only happening if I move slider quickly back and forth betwean steps. If slider is moved one step at the time plugin dont crash max. I belive the problem is in fact that it tries to update the model on the fly but due to quick changes it fails and crash.

    P.S. Sorry for my english:)

  27. This tutorial rocks! :)

    You are pushing the limits Peter. :) Congrats!!

    I’ve a question about DOF + trees, maybe you been throw this already:

    I’ve been doing some test using zdepth_vray_layer to later on play with it in After Efects. This permits to easily control and animate the blur amount and the focal point after rendering. However zdepth layer gives very bad results with opacity maps… still don’t know why. Maybe it’s just me doing something wrong :’(

    I’m going crazy trying to combine the opacity mapped leafs with DOF in After Efects via zdepth layer. Maybe i should give up and render dof in vray directly.

    I’m curious about how you animate the DOF effect with your trees.

    Thanks for sharing!
    Truly impressive work.

  28. DrZukunft

    Really impressive work, as always.

    I was wondering how you have made the materials for the trunk and branches?
    Iam currently trying with an selfcomposed photoshop image, merged from photographs ive taken. But the tiling is ruining it, and it does not look realistic.

    Are you useing some kind of procedural texture for them?

  29. Excellent tutorial! Thanks for sharing - share & joy :)

  30. Andrew,

    Is opacity even showing in zdepth channel? I think this didnt work in sp3, it would show the entire geometry, in this case, the leaf plane.

  31. Looks so nice. Gotta try, thanks.

  32. That Post-it! leaf tree is great! LOL - Amazing insight into 2sided material going on here.

  33. hey, Peter, the final shoot is amazing.. and the tutorial probably the best one that I can imagine been available on the web…

  34. awesome!
    perhaps one more render shot with money on trees? who says money doesn’t grow on trees, hehehe..

  35. Hey Peter, the results looks great. I was just curious about say your reflection map. It looks like the the lighting in that map is backed in vs it being flat. I was wondering why that might be?

  36. Hi Peter,

    Thank you for your great tutorial! We had a similar approach to our trees. But you surely showed us some tips on tweaking them to perfection. Thank you very much!

    Do you have any spare time next to the rendering bizz..? amazing your work.

    Best regards from the Netherlands,

    Joost

  37. @pailhead
    Yes, you are wright. Zdepth channel only shows geometry, so the planes of the leafs. and it looks like is not going to change :(

    The problem is not as easy as it looks. The zdepth channel wouldn’t know what to represent in case of ‘grey’ opacity maps. Could work for 100%black&white opacity maps ( as in the case of leafs ) but what happens with grey pixels or semitransparent objects? which distance should the zdepth layer represent?

    One solution; render a fog pass and use it as zdepth. I’m doing some tests and looks quite good.

    Sorry Peter if i’m messing around with this here.
    By the way, i can’t wait to see the Mendes da Rocha house…. i’ve seen you are working on it. :D

  38. andrew, I’m afraid I can’t help, I always do DOF effects in vray. Mendes da Rocha house…. will get around to finishing that someday I hope!

  39. Thanks for the tutorial! great results!
    now I understand how 2sided works. Can I also ask how You managed the get these trees out from onyx?
    Once I tried it, and after a few days of experimenting with broadleaf modeler, I gave up. They didnt look even close to your results, no matter which type of tree i tried and how I tweaked it.
    Best regards! and keep posting

  40. Mujeeb R Yousef

    Hi, Peter.
    Great Thanks for the very convincing tutorial. Highly understanding detail
    Best Tutorial on leaf that I have ever seen.

  41. Are you planning on doing a vraysun/outdoor lighting tutorial anytime soon? I just stumbled upon your site, great renderings, amazing work.

  42. Hi!

    First of all - its a great tutorial and great work!

    Have some questions though - could You explain applying color correction map and also those 3 leaves categories? Did You simply set different IDs for each of them and then made multisub mat?

    Last problem and maybe quite important is that im getting white border line / envelope to each of the leaves - Do You know what might be the problem?

    Thank You for the answer

  43. Cell phone GPS >> Miracles of technology...bring information on ...

    ..]one useful source on this subjectis ,www.peterguthrie.net,..]

  44. still… cant make it work the way its supposed to. When You say transparency OFF or ON which factor do You change to adjust it? opacity map output? (correct me if I’m wrong but the opacity map should also be added to both front and back materials in 2sidedmtl)

  45. Hey Pete - You’ve been pretty generous explaining your techniques (and we all thank you for that!) - Could we push our luck a bit further and ask if you would kindly divulge your vrayphysical camera settings? And do you tweak the vray sun/sky at all or leave them at the default settings? (if it’s not too much to ask, screenshots of the cam/sun/sky settings for the grass and/or tree tutorials would be most appreciated!!!)

    I’m getting decent results using the material approaches you describe, but the quality of light in my renders doesn’t approach yours by a long shot - not being all that experienced with the vray sun/sky/physcial camera system, I’d appreciate any help.

    Thanks a bundle Pete and keep up the excellent work. Cheers!

  46. I am with Adrian in REquesting from you a Tree Tutorials & how to get them realistic Materials after getting it out of Onyx Garden..Special Thanks to your Great Tutorials And hope you make Video Tutorials on your Vimeo Channel Soon..

  47. Hi Peter,

    Great tutorial! You inspired a recent personal project of mine. I sent you an email yesterday or the day before to show you. It may have gone to your junk folder. Please let me know if you got it. I’d like your feedback.

    Great work!

    Jonathan

  48. Hi All,

    Peter’s tutorial inspired me to make my own version. Since I don’t use v-ray, I became a little more familiar with the A&D Translucent Plastic Film in mental ray. Simple cutout map for the leaves and manipulated the A&D translucent plastic film - Opaque, I think. I used an instance of the diffuse in the translucency color slot to allow the light to shine through nice and vibrant. mental ray DOF targeted on the center leaf. Enjoy!

    http://www.3dcreativesolutions.com/Stuff/fallfalling.jpg

  49. Hi Peter,

    I’ve seen that on the exporter you had choose the number of polys, etc…
    when you import it to 3ds max as an object, how do you set up the wind attributes? how can we set up the polys on leafs and still can import that in treestorm?

    thanks.

Leave a Comment