Sunday, March 14, 2010

Tree tutorial part 2

Advanced tricks to get better effect

This tutorial is the second part of this one.

I was not very proud of the result of the first tree I made, so I decided to improve it.

Firstly, I asked my brother to make a good foliage texture, and to make another texture that mix foliage and small branches. That last texture should have branches that start at the center of the image.

So, the trick to do this smarter foliage is to mix 2 kinds of foliage geometry.

The first one was used in the previous tutorial, it consists in ellipsoid (streched sphere) of "foliage only" texture. Now I plan to restrict the use of this one to the minimum, just to "fill" the tree with many leaves.

Here is the second one.

Let's create a pentagon:

  • Create a cylinder, with 1 segment and 5 sides
  • Choose the select vertex tool (shortcut V)
  • Select all vertexes of one pentagon and delete them (shortcut Del), now they isn't cylinder anymore, just a pentagon

Now we have to add the new material. Just like the 1st part of this tutorial, simply open the material panel, create a new material named "branches", browse texture (in this tutorial, I use "textures/joekari_plant/plant_green_branches1.tga"). Don't forget to open model's meta data and add the key/value pair: "MD3_PATH_branches" / "textures/joekari_plant/".

Now select all the 5 faces of your pentagon, open the group panel (Crtl G), create a new group named "branches", set its material to "branches", and click the button "assign as group". Leave this panel.

Open the texture coordinate panel (Ctrl E), and choose the projection type "group" (if it's already selected - sometime this feature is buggy - first select "triangle", then select "group" again). A dialog box appear, asking you from where the projection is set (bottom, top, right, left, front or back). Choose the right option (it depends on which viewport you have drawn your cylinder). If you don't know what to choose, simply choose the same than the viewport's name where you have your pentagon (other's view only display lined vertexes). Then, adjust scale and rotation to get the most of your texture without having seam:

Now select the central vertex of the pentagon, and in another viewport move it (shortcut M).
You have a nice set of branches.

Now, just copy and paste them everywhere on your tree.

Finally, just mix the 2 kind of foliage (pentagonal with branches and foliage texture, and ellipsoid with foliage only texture).
Use only few ellipsoid foliage, one per big branches.
You should get this :

(Note that on this screenshot, I have enabled alpha blending for the 3D viewport, in the menu : "view -> 3D alpha").

And in game :

Yeah, I'm pretty proud of this one, hope you like it too ;)

No comments:

Post a Comment