I have added the ability to adjust how many trees to grow and also place the seed point of each tree.
I sorted out all known problems with the multiple L-system implementation. Now any number of L-systems can be grown at a given time. The position of the trees is currently hard-coded though I will make this dynamic at a later date. This marks all the planned features implemented though to a varying degree of success. The final stage of this project will only focus on improving these features.
I have started implementing the final feature of the L-system which is to grow multiple trees simultaneously.
A linked list is created for each tree. In each list are pointers to structures used to generate the tree. There are still some bugs in the implementation which cause the lists to not draw correctly which causes frequent crashes. Figure 1 shows the greatest complexity currently achieved. The goal of the new L-system string interpretation is to reduce a bias on branches when calculating self-occlusion and self-collision. Growing multiple branches almost simultaneously has been achieved but I have further improved the system. Below in green we see the branch growth order. At each stage the branches are grown in numerical order. I have therefore created a simple function to shuffle the order of growth which is shown in purple.
As a slight break from the light implementation I have started to work on collision avoidance. Now if a branch attempts to pass through an object the program will try and find an alternative direction for the branch. There is a restriction on the maximum rotation that the branch is allowed to be adjusted by. In figure one shows the final branch in green as well as the attempted paths in red. In the implementation of this I have managed to implement a small bug. The problem is with the implementation of self collision. The problem has been identified though I have yet to solve it. The problem affects the growth order of the branches and can be seen in Figure 2. The tree should branch at the stem but it does not. Solving this problem will be the next item I am going to work on. So far all the light I have been calculating is diffuse which is fine but I want to have a sun as well. This is what Ned Greene did in his implementation [1] with the greatest influence on voxel luminosity coming from direct light. With the sun arch (shown in Figure 1) the points are going to be uniform since the earths rotation is at a constant rate. By changing the arch light conditions at different latitudes can be represented. This is just a quick Python prototype so I will put it into the actual system next. [1] N. Greene, "Voxel space automata: Modeling with stochastic growth processes in voxel space," Computer Graphics, vol. 23, no. 3, pp. 175-184, 1989.
I have sorted the rotation issue. As suspected the problem was that rotations were being calculated in local space. I could probably have done a world space rotation function but it was just as easy just to check the draw matrix and determine which was to rotate branch. In the above image the tree is currently only being rotated around the z-axis. So I check the x co-ordinate system of the y axis to the x co-ordinate of the x axis. All I need to determine is whether they are positive or negative in order to know what rotation to apply on the z-axis.
The other tiny feature added is that the angle of rotation is now based on the difference in light between the two directions. This creates the effect as seen in Figure 1 where the tree bends more towards the light if it is growing in a deeper shade area.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
March 2014
Categories |