Sunday, July 21, 2013

The Growth of a Tree - Another 3.14.0 Update

Well it is time again, time to take a peak into the progress of 3.14.0. We are still not done, but as I mentioned in our last post we have been working on making the new tree generation code more reusable, so although we only have one more new tree completed today, the Bald Cypress, in creating it, we added most of the building blocks that will be needed for the last remaining trees.

But before we get to far ahead of ourselves, lets take a look at the normal Cypress and see how it has developed since last update.
Leaner, Meaner but Not Any Greener.
Since the last update we have put a bit more work tweaking the settings on the cypress trees to get them to look more like our reference photos, while at the same time still allowing for a degree of variety in their generation. This new breed of Cypress are thin and lanky with a nice variety in height, with their leaves starting at a variety of different heights as well.

As for the Bald Cypress, I thought that it would be neat to give a look into how it developed, which meant more pictures than normal, so in keeping with the current front-page format, the story of the Bald Cypress development is after the break.
The First "Knees" And Trunk
The first thing that we needed to do for the Bald Cypress was to write the code to generate the the 2x2 trunk, using the new version of the quarter logs block that the bald cypress uses. Not much to that part really, just making sure that the the logs were generated in the proper orientation. The same needed to happen with the "knees" and in our first test we mainly focused on making them spawn or the sides of the tree.
Random Heights and Placement
Once we had the "knees" generating in the correct orientation it was time to add some height to the mix. Some "knees" would generate on the left half of one side of the tree and some on the right, and occasionally there might be on on both haves, or even no knees on that side.

After the knees were finished it was time to move on to the branches. Although I could have reused the of the old code for other trees like the large Autumn Forest tree, I decided that we should start out with self documenting code that would be a littler more reusable down the road.
Forgetting a Variable Can Cause Some Weird Results.
It took a number of bug fixes to get the branches to work correctly, as I missed out on a number of things during the initial code that had to be fixed. some of them were outright funny looking, like the picture above, while other's were a little more frustrating and I had issues tracking them down until later on when I started on the leaf clusters.
A Preliminary Foliage Test
Once the branch generation code had been fixed it came time to nail down the leaf clusters at the end of each branch. Once more there was some issues with the codes transition form paper to actual code, and the initial tests ignored the settings to allow the leaves to generate at heights other than what is pictured above, limiting the variation in how the foliage looked. Also, if you look carefully in this first shot you can see that the top of the main trunk is completely bare. It needed a little more work and a lot of tweaks but eventually we got got something that pleased the team.
A Sample Bald Cypress Tree Grown From Saplings
Although this is a fairly beautiful tree and has a large amount of variety possible as it generates, there is still a bit more room for potential improvement, so don't be surprised if the tree changes a little as we get closer to release.

No comments:

Post a Comment