I have finished implementing a sun arch. The influence off direct light versus indirect light has an impact on the plant growth. This is a simplified representation of plants in nature where different species have adapted to growing in direct sunlight or shade. Figure 1 shows different results depending on the rotation of the sun arch and the influence of the sun. The light brown mesh represents a wall. The blue cubes is the sun arch. In the top image the influence is only 0.5 but the sun is not occluded by the wall. In the middle image the suns arch is behind the wall and its influence is 0.9. The size of the plant produced is therefore smaller than the top plant. The bottom image has the same sun arch but the influence of the sun is reduced to 0.1 So far the methodology is working though the visual results are pretty crude. Although I will sort this out at a later date the next stage of the project will be to try and grow to L-systems simultaneously and have them competing for space and light. |
0 Comments
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.
I have re-implemented all the old features into the new draw algorithm. One nice thing I discovered was that there is no need to worry about '[' and ']' storing transformation matrices any more as the new system can draw multiple branches simultaneously using inheritance of attributes.
The only new thing in the images is that the leaf size is affected by light intensity but that was very simple to implement. Its just the same as branch length. Next stage which is going to be interesting is to had the tree grow towards the light Well I have started putting together all the bits for the new draw function and it works. The image shows the final tree 1) as well as a snap shot during the development. It is clear to see that all the branches are now growing together rather than one at the time. I had to add a few more elements to the structs. This included a transformation as well as storing the previous transformation matrix. The reason for this is that if this is not done then the branch might inherit the wrong matrix if its parent branch has been transformed before it in the draw list.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
March 2014
Categories |