Tuesday, 10 May 2011

Crazy golf- building the scene (part 3)

How to build a realistic tree in Maya! The background of my crazy golf animation has up until now been devoid of any detail. The animation needs to be believable and therefore it was necessary to add some scenery other than that which the golf ball will interact with- even if it is only on screen for a brief moment in time, it will help to establish to the viewer that the animation events are occurring in a realistic world. I decided to add some trees and a fence around the course, which hide the boundaries of the floor giving the impression that the 'world' is far greater than it actually is. 

Until yesterday, I had no idea how to go about making a tree- so as usual, I found a very helpful set of YouTube tutorials to help:

Following these videos, I felt comfortable with the process and was actually very surprised as to how simple it is to make a tree. I decided to make an oak tree, somewhat synonymous with English woodlands, to create a park setting for my crazy golf course. The first step was to obtain a photorealistic image of a leaf. You can see the one I chose below:

Now, in the video series above, the tree begins with single leaves being placed into the scene. To save time however, I decided to use Photoshop to turn the image above into the image below; a small bunch of leaves which will reduce the time needed to place them effectively onto the branches. A key thing to point out is that the image will be applied to a flat plane in Maya- hence the background should be transparent. This can be achieved with a PNG file. The initial image from Google did not have a transparent background despite being a PNG, but this was corrected with a very quick edit in Photoshop.

I created a new plane in Maya and applied the 2D edited leaf bunch image to it, to the above results. The next step was to model a branch, comprising of a basic low poly cylinder with several divisions. The vertices on these divisions were moved to create various twists in the branch, before I applied a wooden bark texture. 

In short, the process of making a tree is moving up in branch sizes- add small twigs to a medium branch, add these medium branches to a large branch, and so on. 

So, as aforementioned, the small twigs were added to a larger, medium branch...

... which in turn were added to an even larger branch!

Now for something a little different- the tree trunk. As with the branches before, this was created with a low poly cylinder, with vertices moved appropriately to create a bendy core structure. The tip of the trunk trailed off into a point, forming a branch at the top to be disguised amongst the other branches and leaves.

The largest branches are those which (no pun intended) branch off from the trunk. Again created with the same process, they were moved into place until I was satisfied with the shape. I was careful not to make the overall shape of the tree too symmetrical, since in nature everything is completely random.

The texture was added to the trunk and branches, making use of the various UV tools to orient them correctly.

Lastly, the largest branches were duplicated and placed all over the tree body, rotated to face numerous different directions. This means that from whatever side the tree is viewed, the foliage looks dense. It is very much a process of 'keep going until you're happy with the results'. You can add as many branches as you like- just beware that overlapping leaf planes can look a little odd under certain lighting.

By this stage, I had completed my tree model and was ready to import it into my crazy golf scene. Here however, I encountered an unforeseen issue; the tree drastically slows down Maya- and that's with only one tree! Since I had always planned a woodland setting with many trees, I therefore needed to find a way to include them without ultimately crashing the program. Thinking back to how I created that initial leaf cluster, I decided to use 2D trees, placed on vertical planes. After all, they would only be on screen for a moment, and I do not need to animate them.

I selected to view the tree only, since I needed the background to be transparent. To turn my 3D tree into a useful PNG file, I turned my render settings up to the maximum 1080p HD (to get the best image), and positioned the tree in the perspective window such that the rendered frame captured a perfect side profile of the model. From the render window, I could simply save the image as a PNG (The black background of the render represents transparent areas!) and save this directly to the project's 'sourceimages' folder.

I created a new plane in Maya and applied the tree image to it, with very pleasing results. You probably notice from the image above that the trees look very dark. This always seems to happen when adding PNG files to a plane, and I can only assume at this point that it is due to lighting and can be easily rectified. Anyway, you can see that I added many more 'trees' and resized then for variety. I placed them in a perimeter around my golf course such that no matter what direction you look from the hole, you see trees in the background. They were of course spaced in a non-uniform manner.

I still had a problem with the ends of the floor plane being visible between the trees. To go some way towards solving this, I decided to add a wooden fence around the course, which also helps to show that it is a well-kempt activity and not a derelict attraction from decades ago. Like the trees however, the row of fence posts slowed Maya to a near halt, and so I resorted to using a PNG image on a plane, in the same vein as with my trees. This plane was duplicated and placed around the entire course, making certain that the fence post images were continuous.

As you can see from the final image below, the PNG images are darker than before, though in a way I do prefer them this colour. Having the background scenery as flat images does work very well, since they are in the distance and I do not need to see them from any other angles. 

The background as seen above still looks a little sparse, even with the trees added. When I get the opportunity I shall add more detail to the background in the form of PNG images (shrubs and bushes for example) which will further increase the believability of my woodland park setting. I may still add a full 3D tree to the course as well, though I will have to determine whether this will be practical when all my other obstacles are complete.

That's it for part 3- until next time!

No comments:

Post a Comment