2
$\begingroup$

blender-screen

I am trying to make scenes with natural looking trees in Blender. In Blender cycles I try to bake texture images for the leaves but I cannot manage to bake the alpha.

$\endgroup$

2 Answers 2

5
$\begingroup$

Start with a picture of leaves. This one I took is not the best example since I did not put the leaves on a neutral background which makes selecting the background in a 2D editor less precise. Just put the leaves on a sheet of paper when taking the picture and things should work out.

(if you have difficulty seeing detail of the images I've posted, you can right-click the picture and select View Image. It will open up to it's full size.) enter image description here

Now in GIMP or preferably Krita because the selection tool is much better, select the background and flood fill this selection with black. Invert the selection so the leaves are outlined and fill them with white. You may also want to blur the mask a bit so the leaves have soft edges. This will help to hide artifacts left from the selection tool.

enter image description here

Now I baked the leaves using the following nodes, you can set the render samples very low for baking Emission. There should be no noise at all using 8-16 AA samples.
Remember to increase the color value of the Emission shader all the way to full white. It's default is 0.8. Set that to 1.0 instead.

enter image description here

This is the result I got from the bake.

enter image description here

And the final node setup up for the scene render, enter image description here

Update:

To separate leaves like this you can enter Edit mode with the plane selected which has the leaves all together on one sheet. This will make it easier to UV unwrap the separate leaves. So now add a bunch of planes and scale them to the size of the leaves on the image plane. Now select everything, including the plane which has the leaves already and press the 'u' key and select Project From View(bounds). The original plane will act as a container for the unwrapping algorithm and this will keep the new leaf planes proportional to the image they will be mapped to so no extra adjustments will have to be made at this stage.

enter image description here

Now locate the UV maps area that is shown in the following image and click the + sign to add a new UV set and give it a name that makes sense to you. Also make sure to activate it and click the camera icon at the right side. Whatever is selected here will be the image that is baked to. Now this time for Unwrapping, I used the one at the top labeled 'Unwrap' and I set the margin to '0' since the edges will be transparent and there will be no seams. There will also not be any mip-mapping issues because of the transparency if you decide to also do something like this for a game.

After they were unwrapped and the original plane was deleted, I selected all the 'leaves' and separated them using Separate p->By Loose Parts. Now return to Edit mode, select them all and use Ctrl + g to make them a group. You can now use this group in the Particle generator settings to add them all in together but still as separate pieces.

enter image description here

To bake the color, I used the baked texture that I showed how to make from the steps earlier. Here is what it looks like now.

enter image description here

And I also did the same thing for baking the black and white stencil. I just replaced the baked texture node with the stencil node from the earlier steps.

enter image description here

Next, I used Texture Paint mode to clean up the edges for both the newly baked textures.

enter image description here

I then sketched out a quick wireframe for a tree then used the Skin Modifier to fill it out. Applied the modifier and clean the mesh up a bit then added a Sub-surf modifier. Now I added a particle system set to Type:Hair and adjusted a few settings. I also used Weight Paint mode to control the leaf Density and Length. Here is the final result.

enter image description here

$\endgroup$
2
  • $\begingroup$ Works well for 1 single plane but not for a complex UVmap like leaves of my trees. Thanks anyway, Johan. $\endgroup$
    – Johan Bil
    Aug 6, 2014 at 15:43
  • $\begingroup$ Dear adviser. Now I understand that our approach of drawing trees and plants differs too much. As you might notice on my Facebook or website (jb3d.nl) my objects were created in external programs like tree(D), Arbaro and the amazing Ivy-generator. Those programs create and export their own UVmaps and I import it as Obj.objects. $\endgroup$
    – Johan Bil
    Aug 8, 2014 at 14:44
0
$\begingroup$

Maybe you could use a mix shader with an emission shader and a transparent shader.

In the node editor:

Factor: Use the alpha map (black and white) that you used for the leaf.

Emission shader: Use the image you just baked (no alpha).

Transparent: leave it white.

I haven't tried it but I think could work.

$\endgroup$
2
  • $\begingroup$ Works well for 1 single plane but not for a complex UVmap like leaves of my trees. Thanks anyway, Johan. $\endgroup$
    – Johan Bil
    Aug 6, 2014 at 15:43
  • $\begingroup$ Dear advisers. Now I understand that our approach of drawing trees and plants differs too much. As you might notice on my Facebook or website (jb3d.nl) my tree and plant objects were created in external programs like tree(D), Arbaro and the amazing Ivy-generator. They create and export their own UVmaps and I import it as Obj.objects. I created my own textures with alfa-, normal- and specular maps to make my objects. The results in the Blender Game Engine are amazing. But unfortunately my system has its limits and slows down too soon. So I began to try Cycles and bake for material mode. $\endgroup$
    – Johan Bil
    Aug 8, 2014 at 15:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .