Leaf shader tutorial

Bof, I was just supposed to answer an user’s question over at CGtalk and it ended up as a mini tut with a blend. Sure users of Elysiun should not be left apart. Here it is:

I use Orco, a simple grid, and a simple png file of leaf I scanned and postprocessed in Gimp. This png is lowdetail for download purpose, should be a minimum of 1000px in loseless format.

1-Scan you leaf, flat on the glass. For this I used one of our famous maple leaf from Canada!
2-Go in your favorite paint program, Photoshop of Gimp.
3-Add a alpha channel and put all but the leaf in clear alpha, save in a format supporting alpha, and supported by blender like png, tga, psd.
4-In Blender add a complex grid so you can give it some bump, using the subsurf with a lowpoly grid is also an option.
5- Add a material
6- Drop alpha to 0 in “Material” panel and drop spec to 0 in “shader” panel.
7- Go in “mirror transp” panel, enable Raytransp.
8- Go in texture and add a texture channel, Go to add an other one but instead of creating a new, use the same by selecting it using the pulldown menu.
9-In first channel, go in the “Map To” panel and select col and alpha.
10-Select the channel 2.
11-In “Map To” panel, select nor and spec.
12-In this same panel, drop the “var” to 0.5. And cranck the Nor slider to 5.0
13-Go in texture buttons(F6Key)
14-In one of the 2 channel (it’s the same!) add an image, load you file with the alpha channel.
15-In the “Image” panel, press the “Usealpha” button.
16- Also, press the “clip” option. If it’s not already done (maybe not necessairy).

That’s it.
Download the blend here.

Some example, not all in the blend though:

Nice work. Thanks for sharing. I’ll use it a lot.

this is great! thanx for sharing!

Good work, this technique gets great results :slight_smile:
However IMHO, I think it’s a little dependant on good photos/scans, and unless you can do them yourself, they are hard to find :expressionless:
And besides, we don’t have any Maple Leaves here where I live :stuck_out_tongue:

Hmm. I kinda lost you in the tut but… Nice leaves. Look very good. I’m going to try to figure this out.

Wow, after looking at this blend, I am surprised. I never knew you could do anything like this. How do you make the rest of the mesh invisable? I noticed in the texture window that you selected Clip. Does this have anything to do with this? I want to learn how to do this.

Now heres something that the Lsystem needs to do. Make high res leaves and then you have some basic textures like, (brown, green, red, yellow, with certain textures). like in a way what Bryce 5 does with they leaves and the tree trunks.

Well, the Image he is using has an Alpha Channel (.PNG usualy), in the Texture Buttons>Image hit the UseAlpha Button to activate it, then do the rest of the Alpha procedures that Gabio explains :stuck_out_tongue:

Cool to know it’s usefull. mmm
Wouldn’t be cool to get such little tuts more often :slight_smile: Something cool for the BlenderArtise project… There was a place for that once in elysiun… But then there wasn’t as much users… this may be more feasible now. Look:

shall we start a tutorial board for all kinds of tut? I found tutorials all around in ‘news and chat’, ‘wip’, ‘finished projects’, ‘other software’ board

it’s planned In BlenderArtrtist, i’m sure of that since we now have the user base to maintain it.

thanks Gabio - nice tutorial

quite nic tut right there, but the downloadable .blend doesnt semm to work correctly!

can you fix that?

Working great where.
I’m sure it’s my server try redownloading it again
I’m sure you got a crc error anyway.

If you use specularity the mesh will be specular where it should be transparent.
To fix this, make sure SpecTra is 0 and that you use Ztransp instead of Ray Transp.
Not using Ray Transp is no problem since you won’t want any refraction.

It’d be nice to have a script that would remove the useless (transparent) vertices from the leaf mesh. :slight_smile:
Too bad I don’t know python :\

Cool tutorial, but how do you prevent the leaf from casting square shadows?

Sweet tutorial :slight_smile:

Cool tutorial, but how do you prevent the leaf from casting square shadows?

I could be wrong (I don’t do this kind of texture stuff much) but I’m pretty sure lights don’t cast shadows through transparency, so that shouldn’t be a problem.

Yes, but what I just saw sort of countered that. I’m pretty sure that the leaf casted a square shadow.

Yes, but what I just saw sort of countered that. I’m pretty sure that the leaf casted a square shadow.[/quote]
you saw the mentions of using a ray-shadow based lamp and having trashadow [in material buttons] selected for the material RECIEVING the shadow right?