top of page
Search

Week 41&42 ( Oct. 5 - Oct. 18) Leaves Generation

  • groupyyzdh2323
  • Oct 19, 2020
  • 2 min read

Once the branch mesh is generated, the procedural generated model already provides a relatively nice looking representation of a tree structure. Regarding the leaves, there are many ways of implementation based on our knowledge. Modeling a prefab and instantiating it can be a way of achieving our desired outcome.

Meanwhile, in some works, a particle system is used to simulate leaves of a tree.

However, we found out that we can also create leaves through a procedural generation approach. The idea is to script a flat surface with materials attached. We consider creating a quadrilateral mesh as the primitive game objects for holding materials, this can be a Quad or Plane as the default game object in Unity, but we will create it through script.


Learning from the documentation, Unity processes and displays geometry in triangles rather than quads. Therefore the construction of a Quad mesh consists of two triangles. The first step is to define an array of vertices which is used for creating the shapes. A Quad contains four vertices per side. Imagining the Quad lies on the xy-coordinate system as illustrated as the figure below, then the vertices can be expressed using width and height as variables. Since the Quad needs to be two-sided for texture display, an array of eight vertices is defined.


The script also needs to define the correct normals for shades and texture coordinate(uv) for texture display.

To present the feeling that the leaves are actually “growing” together with branches, the leaf generation function is called when there is a new branch generated then it will place a quad at that segment. It can be seen from the image, the green quad representing leaves sufficiently provides an impression of a tree already. However, the shape and surface of leaves can be very important for presenting the biological information of the tree types, therefore we will not skip the texture mapping procedure.

We obtained a flat leaf image which can be a good candidate for the leaf's texture and make its background transparent. By attaching the texture image, a more realistic visual representation of the tree model is completed fully from the procedural generation.


Reference:

[1]. 3D Model of leaf - file NaturalLeaf_OBJ.OBJ. https://www.youtube.com/watch?v=x75wqpCuxac



 
 
 

Comments


©2020 by Group YYZ Weekly Blog. Proudly created with Wix.com

bottom of page