Add and apply Geometry forces
To add and apply a Geometry force, you must add a Geometry force and assign geometry to it. To get the effect you want, add a behavior to the Geometry force. You can enable and disable the force and manipulate its settings in the Properties window.
Add a Geometry force
Geometry forces are added just like any other force. To add a Geometry force:
Do one of the following:
- Right-click in the Tree Window and select Add force.
- In the Generation Editor, click the magnet icon and select Add force.
- From the Tree Window toolbar, go to Scene > Scene Objects > Force > Add force.
From the Add force drop-down, go to Geometry > No specified mesh. This adds an empty Geometry force to your scene.
Assign geometry
Geometry forces can use mesh data from two sources: mesh assets (imported models) or generators (meshes created by the procedural modeler).
Assign geometry using a mesh asset
Create a mesh asset by importing a model. In the sample mentioned in Geometry forces, a simple model of a rook from a Chess set is used.
To assign geometry using a mesh asset:
Select the Geometry force in the Tree Window.
In the Properties window, under Geometry, change the property Geometry:Source to Mesh Asset.
Select your mesh asset with the property Geometry:Mesh Asset:Mesh.
Note
If you’re using a mesh asset, you can assign a material to it, embed it in the model, and transform it with the scene gizmo using the other properties in the Geometry:Mesh Asset group.
Assign geometry using generators
When using generators as the source you can select as many of the generators to contribute geometry to the force as you’d like. To assign geometry using generators:
Select the Geometry force in the Tree Window.
In the Properties window, under Geometry, change the property Geometry:Source to Generators.
In the Generation Editor, go to Actions > Geometry force actions to assign generators to the new force.
If you’re using generators, this geometry will update every time the model updates. You don’t need to do anything else. This feature enables you to freely change the model and have other parts of the model update accordingly. You can add or remove generators as you like and you can have as many Geometry forces as you need.
Using generators as the source of the geometry requires some special consideration. Refer to the final section of this page for more information.
Using generators: Compute order matters
If you’re using generators as the geometry source you must take the order in which the generators are computed into account. In general, all the generators that make up a Geometry force must be computed before any generator that uses that Geometry force. The only exception is that a generator is allowed to use a Geometry force made from itself (and only itself). This exception allows for things like roots not to intersect with each other even though they’re in the same generator.
The screenshot below is from the sample named “vines_on_tree.spm” in the Geometry forces sample folder.
Notice that several of the vines have a “Pass” level shown next to them. Computation is done in passes. Each generator is in the first pass unless otherwise edited. In this example, “Trunk" and "Branches” are in pass 1 (pass 1 is the default and remains unlabeled). “Vines A” is in pass 2 and “Vines B” is in pass 3. The computation order is as follows:
- “Trunk” and “Branches” happen in pass 1. This is done to get the basic tree shape finished. “Vines A” and “Vines B” are ignored in this pass.
- “Vines A” is computed next, in pass 2. It is now free to use the Geometry force called “Tree” that uses the parts of the model computed in pass 1. The pink circles on the “Trunk” and “Branch” generators indicate they are in the same Geometry force (you can click on the circle to select the force). It also uses the Geometry force called “Vines A Force” to make sure the vines don’t collide with themselves.
- “Vines B” is computed next, in pass 3. It uses both of the Geometry forces that “Vines A” used plus a new one, “Vines B Force”, to again stop self intersections.
You can edit the pass number with the property Generation:Shared:Pass. A generator’s pass number will not be allowed to be lower than that of any of its ancestors (it can’t compute until its parent is finished). When making several generators collide against each other, be sure to carefully think about the order in which they need to be computed and make sure the pass numbers reflect that in your model.
Note
Pass errors are detected automatically and an error message is displayed on the generator.
Add a behavior to a Geometry force
Behaviors control how Branch generators react to the geometry in the force. Geometry forces can have multiple behaviors and the behaviors that are used are specified per generator.
For example, think of a scene where you have a barn, vines, and a nearby oak tree. The idea behind behaviors is that you have one Geometry force (the barn), then separate behaviors for things that might interact with it. Vines might be attracted to the barn and crawl along it while oak tree branches might avoid the barn and stop if they hit it.
To add a behavior to a Geometry force:
Select the Geometry force in the Tree Window.
In the Properties window, under Behavior, customize the properties to create a behavior.
Refer to Geometry force Behavior properties for more information.
Enable and use a Geometry force
Geometry forces are enabled and disabled just like any other force:
Select the generator.
In the Properties window, navigate to the Forces group and enable the Geometry force in the list.
Below is a screenshot of the “Single Vine” generator enabling the Geometry force named “Rook”.
The value of the property is multiplied by the Geometry force’s strength value and applied to the branch. If more than one behavior has been assigned to the Geometry force, choose the desired behavior by clicking the name field on the force property and selecting it by name. The parent curve and profile curve can be used to change the force’s influence on the branch in the same manner as any other property.
In the example above, the Geometry force named “Rook” is being used to attract and obstruct the vine. This setup is very common. The Attract behavior pulls the vines toward the Geometry force according to the strength settings. Then, when it hits, the obstruction aspect of the behavior causes the vine to crawl along the surface.
Once a Geometry force obstructs any given branch, the properties in the group Geometry Force Crawling on the Branch generator (pictured below) control how the branch will crawl over the surface of the geometry.
These properties are explained in detail in the Branch generator properties, but the general idea is to use these properties to convey how much the branch can bend (Max bend angle), how much of it can press into the mesh (Tolerance), how hard it tries to find a solution (Max iterations), how much it anticipates what it will need to do (Look ahead), and what it will do while it’s touching (Follow).
Because it’s not always possible to find a solution for placing the branch under these constraints, the Results group exists to control how to handle both failures and successes. For example, you may want to throw out any branch that didn’t perfectly crawl along the surface, or you may choose to stop it at the point of error.
Note
All force actions and crawling operations are performed simultaneously. Their order in the list of forces does not influence the computation.
Use a Geometry force to align
All forces have an Align strength property. Any generator that enables a force will combine its own Forces:Align settings with the force’s Align strength to influence how all nodes are initially oriented. This is different from just making them bend very early; aligning actually changes where they are attached to their parent and in what direction they point.
When a Geometry force is used to align it will cause nodes to shift away from the geometry as much as possible at their anchor points and point away from the geometry as well. This technique is useful, for example, to ensure ivy leaves do not cut through the wall they are growing. All of the leaves used in the “Vines” example use alignment for reference.