Menu

User_Guide_Modeling

Prev:Interface Next:ngpshot

Overview

ngPlant uses hierarchical model to represent plant structure. In this model there are one or more branch levels. Each branch level (except trunk) have parent branch. We will use zero-based branch level numbering scheme. So trunk will have level 0, branches which grow from trunk will have level 1 and so on.

To describe plant branches we need to define branch shape, branch material and rules for generating sub-branches. In our application we call these parameter sets as stem model, material and branching algorithm.

Stem model defines 3D-shape of branches. Four stem models - Tube, Quad, Wings, and Generic mesh (or G-Mesh) are supported in current version of ngPlant.

Branching algorithm defines were branches will be located relative to their parent and how they will be oriented. Branch count is defined by branching algorithm too.

Material defines visual appearance of branches. By changing material parameters you can change branch texture, base color, texture coordinates generation mode and so on.

To edit plant structure click right mouse button on trunk or branch item at structure control panel. From showed popup menu you can append new or remove existent branches, change stem model and control branch visibility.

Stem models

Tube stem model

There are three sections in tube stem model parameter panel. First section named Axis parameters contains parameters which define tube axis. Second section Cross-section parameters defines tube cross-section, or profile. Last section (Phototropism) defines influence of light source location on tube axis orientation.

Axis parameters

Length parameter defines base length of tube (along its axis). For trunk (zero level branch) it is an absolute value in some logical units. For other branch levels it is a scale factor relative to parent branch length.

Variation parameter defines amount of randomness which will be applied to base length. Zero value disables randomization. Value of 1.0 for this parameter allows base length to be in range [0..2*base length].

For many (if not for all) plants branch length depends on their location on parent branch. Offset influence parameter allows to control this dependency.

Tube 3D model consists of several tube segments connected to each other. Resolution parameter control segment count.

Each stem segment can be rotated relative to its predecessor by some random angle.Axis variation parameter control the range of such variation.

Cross-section parameters

Radius parameter defines base radius of tube. For trunk (zero level branch) it is an absolute value in some logical units. For other branch levels it is a scale factor relative to parent branch radius at point where branch is attached to its parent.

Profile parameter (defined by curve) allows to define how branch radius is changed along its axis.

Cross-section of tube model is a circle. Resolution parameter defines count of segments which will define circle. Minimal value for this parameter is 3.

Phototropism

Phototropism is a directional growth of plants toward light sources. For stem tube model direction to light source can be either (0.0,1.0,0.0) - positive mode, or (0.0,-1.0,0.0) - negative mode.

Mode sets phototropism mode.

Distribution parameter defines how phototropism influence would be distributed along stem length.

Quad stem model

Quad stem model has rectangular shape. Version 0.9.2 extends this model with new feature - rectangle can be bended along its Y axis, using Sections, Curvature and Thickness parameters.

Quad parameters

Length and Width parameters define size of rectangle in some logical units.

Scaling parameter (new in version 0.9.2) allows to scale model depending on its location on parent branch.

Sections parameter control count of segments in one branch. You should set this parameter to 2 or more if you want to bend your rectangles.

Curvature parameter defines profile of stem.

Thickness parameter control thickness of model.

Wings stem model

Wings stem model is useful for creating palm leaves, ferns and similar ones. Unlike Quad and Tube stems, exactly one Wings branch grows from parent branch. Wings stem model can not be set for the trunk.

Wings parameters

Width parameter defines a width of stem surface. Length of surface is determined by parent stem length.

Sections, Curvature and Thickness parameters allow to bend stem surface. Sections parameter controls the precision with which stem profile will follow a curve from Curvature parameter. Thickness parameter set bounds of bending.

G-Mesh stem model

G-Mesh is a stem model which allows to use arbitrary meshes for the branches. Unlike other stem models it does not support any kind of parameterization, so all G-Mesh branches of the same branch group will looks the same.

Most of the time, 3d-model is imported from the .OBJ file. Since most of popular 3d-modelling applications can export model in this format, any of them can be used for this purpose. .OBJ file must meet the following requirements if it will be used for G-Mesh model:

  1. Only quads and triangles are allowed
  2. Vertex coordinates, vertex normals and texture coordinates information must be present

Also, attention should be paid during texture unwrapping phase to make it friendly to tangent-space calculation process. Tangent-space calculation is required for normal-mapping. If normal-mapping is not used, tangent-space generation can be disabled during model import.

To use G-Mesh stem model right-click on required branch group and select Stem model->G-Mesh->Import .OBJ. You can use Stem model->G-Mesh->Triangle and Stem model->G-Mesh->Rhomb to create simple branches with triangle or diamond shapes (useful for leaves if Quad stem model does not suit your needs).

Branching algorithm

Density parameter contains count of branches per one logical unit.

Variation parameter allows to add some random variation to branch count.

Multiplicity parameter (new in version 0.9.2) allows to grow several branches at the same offset.

Min. offset and Max. offset parameters allow to limit branches locations along parent branch axis.

Each branch can be rotated around parent branch relative to previous branch by angle defined by RevAngle parameter. Variation parameter allows to add some randomness to this rotation.

RotAngle defines angle by which branch will be rotated around its axis.

Declination curve allows to control how angle between branch axis and its parent branch axis will be distributed along parent branch. Variation can be used to randomize declination.

Material

Base color parameter defines the color of branch surface. Click on the button to the right of Base color label to change the base color.

Each material has four texture channels (or layers). Two of these channels have predefined meaning. Dif texture is used as a diffuse color texture, while Nor texture is used as a normal map texture. Two other channels named Aux0 and Aux1 have no predefined meaning. These textures can be used in custom shaders, or by applications which use C++ HLI or Python HLI to access plant models data. Lua export plug-ins have access to these textures also.

Four buttons at the top of Texture layers section allows to switch between texture channels. Buttons which correspond to texture channels with attached texture have blue labels, while buttons which correspond to texture channels without attached texture have black labels.

To assign texture to particular channel, switch to this channel by clicking on correspondent texture layer button, click on the big button to the right of Texture label, and select file using file selection dialog. To remove texture from the channel, switch to required channel and press small button with cross symbol.

TGA, PNG or JPG images can be used as a textures. Only RGB or RGBA images with 8 bits per channel are supported.

NOTE: ngPlant does not use absolute file name to reference a texture image. When image file is selected, ngPlant checks if selected file's directory is in texture search path list. If texture search path list does not contain this directory, warning dialog will be shown and texture will not be loaded. To load texture either it should be moved to one of the directories from current texture search path list, or it's directory should be added to the list of texture directories via Preferences dialog. Please note, that changes to texture search path will take place only after application restart.

Texture coordinates section contains parameters which control how texture should be scaled or stretched in both directions.

V-Scale parameter sets texture scaling factor in the direction of branch axis (V-direction).

V-Mode parameter allows to make texture coordinates to be dependent on absolute offset from branch origin (Absolute mode) or to be dependent on relative offset (Relative mode).

U-Scale parameter sets texture scaling faction in the U-direction.

Mode section allows to control additional material modes.

By default all branches are rendered as single-sided, e.g. only one side of each triangle is visible. It is good choice for Tube branches, but Quad, Wings and some G-Mesh branches may require both sides of triangles to be visible. Double-sided material mode allows to enable or disable two-sided rendering of particular material.

If diffuse color texture have transparent regions, make sure that Transparent mode is enabled. Disable Transparent mode if new texture does not have transparent pixels.

It is possible to enable special billboard mode for the Quad branches. In spherical billboard mode branch rectangle will have its X and Y axes parallel to the camera X and Y axes. In cylindrical mode branch's X axis will be parallel to the camera X axes and branch's Y axes will be parallel to the world Y axes.

Transparency control section allows to control how reference alpha value used in alpha-test changes, depending on current level of detail. Changing reference alpha value smoothly allows to prevent branches from being abruptly appeared or disappeared provided that alpha channel of diffuse color texture contains randomly generated alpha values in opaque regions (usually pixels in such regions have alpha value 1.0). To enable transparency control check Control enabled checkbox and set Fade-in parameter to the LOD at which branch should be fully invisible (reference alpha value is 0.0) and Fade-out parameter to the LOD at which branch should be fully visible (reference alpha value is 1.0).

Prev:Interface Next:ngpshot


Related

Wiki: User_Guide
Wiki: User_Guide_Interface
Wiki: User_Guide_ngpshot