UDC 004.932.2
Doi: 10.31772/2587-6066-2018-19-4-598-604
For citation: Pyataev A. S. [3d tree modeling algorithm]. Siberian Journal of Science and Technology. 2018, Vol. 19, No. 4, P. 598-604. Doi: 10.31772/2587-6066-2018-19-4-598-604
Для цитирования: Пятаев А. С. Алгоритм моделирования трехмерных деревьев // Сибирский журнал науки и технологий. 2018. Т. 19, № 4. С. 598-604. Doi: 10.31772/2587-6066-2018-19-4-598-604
3D TREE MODELING ALGORITHM
A. S. Pyataev
Reshetnev Siberian State University of Science and Technologies 31, Krasnoyarsky Rabochy Av., Krasnoyarsk, 660037, Russian Federation E-mail: pyataev.alex@gmail.com
Nowadays tree modeling algorithms are used in different fields of activity: from computer games to the plantation forest management. Tree modeling algorithm parameters can depend on different factors: it could be features of landscape, climate or geographical location. Depending on the tasks to be solved, the detail level of the created model is chosen. Forest management tasks often do not require a high detail level, it is sufficient to construct a schematic plantation model. For computer games the creation of photorealistic models is required.
The paper proposes an algorithm of 3D tree modeling which consists of the following steps: first step - building a tree framework (modeling the growth of a tree and adding new nodes), while under the framework is meant a set of three-dimensional vectors with attributive data for each vector; then building a tree and overlaying textures. The trunk and branches of the modeled tree are approximated by truncated cones, the axes of which are the vectors of the frame. The tree model constructing algorithm is iterative. Every iteration is a tree growth stage. Thus, the tree is gradually grown to the required level. The developed algorithm allows modeling trees of different state categories. The feature of the proposed algorithm is the possibility of constructing a three-dimensional tree model with any detail level. For example, for coniferous trees it is possible to built a tree up to each needle.
Keywords: tree modeling, growth model 3D.
АЛГОРИТМ МОДЕЛИРОВАНИЯ ТРЕХМЕРНЫХ ДЕРЕВЬЕВ
А. С. Пятаев
Сибирский государственный университет науки и технологий имени академика М. Ф. Решетнева Российская Федерация, 660037, г. Красноярск, просп. им. газ. «Красноярский рабочий», 31
E-mail: pyataev.alex@gmail.com
Моделирование деревьев в настоящее время находит применение в различных областях деятельности человека: от компьютерных игр до моделирования роста деревьев в насаждениях. Особенности построения модели дерева зависят от факторов местности и климатических условий произрастания. В зависимости от решаемых задач выбирается степень детализации создаваемой модели. Для задач лесоуправления и лесопользования зачастую не требуется высокая степень детализации, здесь достаточно построить схематичную модель насаждения. Для компьютерных игр требуется создание фотореалистичных моделей.
Предложен алгоритм построения трехмерной модели дерева. Алгоритм состоит из следующей последовательности шагов: построение каркаса дерева (моделирование роста дерева и добавление новых узлов), при этом под каркасом понимается набор трехмерных векторов с атрибутивными данными по каждому вектору; построение дерева и наложение текстур. Ствол и ветви моделируемого дерева аппроксимируются усеченными конусами, осями которых являются векторы каркаса. Отличительной чертой предложенного алгоритма является возможность построения трехмерной модели дерева с любой степенью детализации. Например, для деревьев хвойных пород можно смоделировать дерево вплоть до каждой хвоинки.
Ключевые слова: моделирование дерева, модель роста, 3D.
Introduction. Modeling of trees is actively used in solving forecasting problems. Thus, in [1] the forecast of forest recovery after a fire is built, in [2] the calculation of forest survival in the long term is carried out, the authors [3] build a forecast of grape harvest using a model of vine
growth. At the same time, the features of the growth of the tree depend not only on the breed, but also on the growing conditions. That is, when building a model of a particular tree, it is necessary to take into account climatic features and the influence of the terrain. Realistic models
of trees can be built on the basis of data obtained from aircraft using active optical systems [4-6]. Also, tree models are used in many computer games. The paper [7] proposes a growth model of larch Ruprecht (Larix princi-pis-rupprechtii) for forest management planning tasks. Such tasks often do not require a high level of detail. The coarsened tree model is represented by three primitives: two cones and a cylinder (fig. 1).
Fig. 1 parameters: H - tree height; D - diameter of tree trunk at chest level; CW - maximum width of the crown; CL - total crown height; CH - height to the widest part of the crown; h1, h2, h3, h4 - is the height of the lower part of the trunk, the height of the top of the cone, the height of the bottom cone and the height of the cylinder respectively; R2 - is the radius of the base of the upper cone; R3 and R4 - are the radii of the bases of the lower cone; R5 - is the radius of the cylinder. Two cones imitate a coarsened crown, a cylinder - barrel. The proposed methods establish changes in the diameter of the bases and the height of the cone, as well as changes in the diameter and height of the cylinder, depending on the age and degree of dominance of the tree in the plantation. The paper [8] proposes methods for modeling vegetation and landscape scenes based on a combination of three-dimensional laser scanning data and two-dimensional digital image data. For inventory methods based on individual trees, such features as the height of the tree, the shape and volume of the crown, diameter of the trunk are calculated.
The paper [9] suggests the interactive way of modeling of a tree which is based on the interaction of the user with the system. At the first stage, the system creates several pretending models from the contour of the tree created by the user.
From these models the user selects the most suitable trees. These selected trees are then automatically processed by the system to create new candidate models. A typical example is shown in fig. 2.
Thus, the tasks that require modeling of trees can be very diverse: from computer games to modeling the growth of trees in plantations. Depending on the problem to be solved, one or another method of tree modeling and its level of detail are chosen [10-13].
An algorithm for constructing a tree in three-dimensional space. The tree model is described as a classical tree-like dynamic structure of data representation. Each node of this structure describes one element of the tree and contains a number of parameters: a reference to the parent node; type; coordinates of the beginning and end of the node; its thickness. It is possible to extend this structure for different tree species and categories. Modeling of tree growth is similar to the two-dimensional case with the correction for three-dimensionality [14].
Construction of a three-dimensional model of the tree takes place in several stages:
1. The construction of the tree frame:
- modeling tree growth;
- adding new nodes.
2. Building a tree on the frame and applying textures.
Fig. 1. Larix principis-rupprechtii model Рис. 1. Представление модели Larix principis-rupprechtii
Fig. 2. Stages of tree modeling procedure Рис. 2. Этапы процедуры моделирования дерева
Fig. 3. Wireframe tree model Рис. 3. Каркас дерева
Under the tree frame we understand a set of three-dimensional vectors with the attribute data for each vector (fig. 3).
The algorithm for constructing a tree model is iterative. Each iteration is a stage of tree growth (fig. 4). Thus, the tree is gradually grown to the required level.
When constructing a three-dimensional frame of the tree, at the time of adding new nodes, it is convenient to use a spherical coordinate system.
So a new node v is created by deflecting from the parent node u by an angle 8 and turning around it by an angle 9 (fig. 5). Right-handed coordinate system is used in this case.
The rotation of the coordinate system by angles 8 and 9 is obtained from the composition of rotations around the OY and OZ axes. The order of turns is the following:
1) turn about an axis OY through an angle of 8 ;
2) turn about an axis OZ through an angle of 9.
The matrix of rotation of the coordinate system through angles 8 and 9 has the form:
M (8,p) = Mz (cp)-My (8) =
'cos8 - cosp -sinp sin8 - cosp^
cos8-sin p cosp sin8-sinp . (1)
v -sinp 0 cos8 y
Let (8v, pv) - the rotation angles of the new node v relative to the parent node u . But the node u , in its turn, is also rotated by some angles, denoting them (8u, pu)
relative to the axis OZ in the base coordinate system. They are calculated by formulas of transition from spherical coordinate system to Cartesian.
Creating new nodes
Q Exit )
Fig. 4. Tree growth modeling algorithm Рис. 4. Алгоритм моделирования роста дерева
Z
Fig. 5. New node creating stage Рис. 5. Построение нового узла каркаса дерева
Fig. 6. Cone performance in X3D Рис. 6. Представление конуса в X3D
Thus, the resulting rotation matrix will be calculated by the formula:
m = M (. Фи )• M (ev. ).
(2)
Accordingly, the coordinates of the new node v in the base Cartesian coordinate system can be calculated by the formula:
= M ■
( 0 ^
v L y
(3)
0 1 2
N - 2 N -1 -1.
(4)
The <Coordinate> section lists the coordinates of these vertex points as follows:
У1 zi.
У2
У 2 N -
-1 . (5)
where L is the length of the new tree node.
To visualize a three-dimensional tree model based on the constructed framework, we will use the VRML three-dimensional image description language or its descendant X3D [15]. A straight truncated cone is constructed on the basis of the frame of each node. Radii of bases - the arithmetic mean between the parameters of the width of the current node and the neighbor on this base. The axis of the cone is the vector of the node.
A straight truncated cone in X3D, from a mathematical point of view, is a regular truncated pyramid (fig. 6).
Such a pyramid is described as follows:
The <IndexedFaceSet> section lists the order of the vertex points that make up the faces and bases of the pyramid. The upper base of such a pyramid will have a description:
where -1 is the face description separator.
The following sequence of steps is used to construct the cone:
1. The coordinates of the bases are calculated, the center of the lower base lies at the point (0, 0, 0), and the top at the point (0, 0, L), where L is the length of the tree node.
2. The angles 8 and 9 for the node vector are calculated.
3. The coordinates of the cone are recalculated taking into account the rotation matrix M (8,9) according to the statement (1).
An example of a tree based on this algorithm is shown in fig. 7.
Thus, using the considered approach to modeling trees, you can build a tree model with any degree of detail. For example, for coniferous trees, you can model a tree up to each needle.
Conclusion. The paper proposes an algorithm for constructing a tree model, which is iterative and each iteration is a stage of tree growth. The algorithm is based on the idea of modeling a tree by its gradual "growing" to the required level. The trunk and branches of the simulated tree are approximated by truncated cones, the axes of which are the frame vectors. For visualization of the constructed three-dimensional model of a tree the language of the description of three-dimensional images of 3D is used. Using the developed approach it is possible to model trees with any degree of detail and different categories of state.
Fig. 7. 3D tree with textures Рис. 7. Трехмерное дерево с наложенными текстурами
References
1. Lindsay M. Grayson, Robert A. Progar, Sharon M. Hood Predicting post-fire tree mortality for 14 conifers in the PacificNorthwest, USA: Model evaluation, development, and thresholds. Forest Ecology and Management. 2017, Vol. 399, P. 213-226.
2. Christopher Thurnher, Mario Klopf, Hubert Hasenauer MOSES - A tree growth simulator for modelling stand response inCentral Europe. Ecological Modelling. 2017, Vol. 349, P. 58-76.
3. Alberto Bressan, Michele Palladino, Wen Shen Growth models for tree stems and vines. Journal of Differential Equations. 2017, Vol. 263, P. 2280-2316.
4. Shaojun Hu, Zhengrong Li, Zhiyi Zhang, Dongjian He,Michael Wimmer Efficient Tree Modeling from Airborne LiDAR Point Clouds. Computers & Graphics. 2017. Doi:10.1016/j.cag.2017.04.004.
5. Robert Beyera, Dominik Bayerc, Véronique Letortb, Hans Pretzschc, Paul-Henry Cournede Validation of a functional-structural tree model using terrestrial Lidar data. Ecological Modelling. 2017, Vol. 357, P. 55-57.
6. Markku Ekerblom, Pasi Raumonen, Raisa Makipaa, Mikko Kaasalainen Automatic tree species recognition with quantitative structure models. Remote Sensing of Environment. 2017, Vol. 191, P. 1-12.
7. Yan-yun Han, Bao-guo Wu, Kai-yi Wang, En-ying Guo, Chen Dong, Zhi-bin Wang Individual-tree form growth models of visualization simulation for managed Larix principis-rupprechtii plantation. Computers and Electronics in Agriculture. 2016, Vol. 123, P. 341-350.
8. Favorskaya M. N. [Landscape scenes modeling based on laser scanning data and digital aerial photographs]. V materialakh vserossiyskoy konferentsii «Obrabotka prostranstvennykh dannykh v zadachakh monitoringa prirodnykh i antropogennykh protsessov» [Proc. of the all-Russian conf. "Spatial data processing in
the tasks of monitoring natural and anthropogenic processes"]. Novosibirsk, 2017, P. 39-43 (In Russ.).
9. Yinhui Yang, Rui Wang, Hongxin Zhang, Hujun Bao ExploreTree: Interactive tree modeling in semantic trait space with online intent learning. Graphical Models. 2017, Vol. 000, P. 1-13.
10. Mihajlenko I. M. [Plant growth mathematical modeling based on experimental data]. Sel'skok-hozyaystvennaya biologiya. 2007, No. 1, P. 103-111.
11. Omelko A. M. [Mathematical model of tree growth in the stands of dark coniferous species]. Biologicheskie issledovaniya na gornotaezhnoy stantsii. 2006, No. 10, P. 86-98 (In Russ.).
12. Omelko A. M. [An L-Systems Based Model of Growth of Conifer Tree Growth]. Sibirskiy ekologicheskiy zhurnal. 2006, No. 2, P. 181-188 (In Russ.).
13. Omelko А. М., Yakovleva A. N. Crown Shape Prediction Model for Picea ajanensis and Abies Nephrolepis Trees in Young Dark Coniferous Stands. Forest science and technology. 2006, Vol. 2, No. 2, P. 129-136.
14. Pyataev A. S. [Tree modelling Algorythm based on Lindenmayer sistem]. V materialakh 20 mezhdunarodnoy konferentsii "Tsifrovaya obrabotka signalov i ee primenenie" [The 20-th International Conference "Digital signal processing and its applications"]. 2018 (In Russ.).
15. Web 3D Consortium. Available at: http://www.web3d.org/ (accessed: 10.06.2018).
Библиографические ссылки
1. Lindsay M. Grayson, Robert A. Progar, Sharon M. Hood. Predicting post-fire tree mortality for 14 conifers in the PacificNorthwest, USA: Model evaluation, development, and thresholds // Forest Ecology and Management. 2017, Vol. 399, P. 213-226.
2. Christopher Thurnher, Mario Klopf, Hubert Hasenauer. MOSES - A tree growth simulator for modelling stand response inCentral Europe // Ecological Modelling. 2017. Vol. 349. P. 58-76.
3. Alberto Bressan, Michele Palladino, Wen Shen. Growth models for tree stems and vines // Journal of Differential Equations. 2017. Vol. 263. P. 2280-2316.
4. Efficient Tree Modeling from Airborne LiDAR Point Clouds / Shaojun Hu [et al.] // Computers & Graphics. 2017. DOI: 10.1016/j.cag.2017.04.004.
5. Validation of a functional-structural tree model using terrestrial Lidar data / Robert Beyera [et al.] // Ecological Modelling. 2017. Vol. 357. P. 55-57.
6. Automatic tree species recognition with quantitative structure models / Markku Ekeiblom [et al.] // Remote Sensing of Environment. 2017. Vol. 191. P. 1-12.
7. Individual-tree form growth models of visualization simulation for managed Larix principis-rupprechtii plantation / Yan-yun Han [et al.] // Computers and Electronics in Agriculture. 2016. Vol. 123. P. 341-350.
8. Фаворская М. Н. Моделирование ландшафтных сцен на основе данных лазерного сканирования и цифровых аэрофотоснимков // Обработка пространственных данных в задачах мониторинга природных и антропогенных процессов : материалы Всерос. конф. 2017. С. 39-43.
9. ExploreTree: Interactive tree modeling in semantic trait space with online intent learning / Yinhui Yang [et al.] // Graphical Models. 2017. Vol. 000. P. 1-13.
10. Михайленко И. М. Математическое моделирование роста растений на основе экспериментальных данных // Сельскохозяйственная биология. 2007. № 1. С. 103-111.
11. Омелько А. М. Математическая модель роста дерева в древостое темнохвойных пород // Биологические исследования на горнотаежной станции. 2006. № 10. С. 86-98.
12. Омелько А. М. Модель роста деревьев темно-хвойных пород на основе Z-систем // Сибирский экологический журнал. 2006. № 2. С. 181-188.
13. Omelko А. М., Yakovleva A. N. Crown Shape Prediction Model for Picea ajanensis and Abies Nephro-lepis Trees in Young Dark Coniferous Stands // Forest science and technology. 2006. Vol. 2, No. 2. P. 129-136.
14. Пятаев А. С. Алгоритм моделирования роста деревьев на основе Z-систем // Цифровая обработка сигналов и ее применение : материалы ХХ Междунар. конф. 2018.
15. Web 3D Consortium [Электронный ресурс]. URL: http://www.web3d.org/ (дата обращения: 10.06.2018).
© Pyataev A. S., 2018