This page has been translated automatically.
UnigineEditor
Interface Overview
Assets Workflow
Settings and Preferences
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Landscape Tool
Using Editor Tools for Specific Tasks
FAQ
Programming
Fundamentals
Setting Up Development Environment
Usage Examples
UnigineScript
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
API
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
CIGI Client Plugin
Rendering-Related Classes
Warning! This version of documentation is OUTDATED, as it describes an older SDK version! Please switch to the documentation for the latest SDK version.
Warning! This version of documentation describes an old SDK version which is no longer supported! Please upgrade to the latest SDK version.

World Spline Graph

World spline graph is a convenient and performance-friendly method to place specified nodes (called source nodes) along a spline graph (its vertices and edges). It is not a single-purpose object designed just to create roads. It can also be used for ropes, chains, pipes, and any objects, having a form that follows a curved path. It is designed to help artists quickly build various complex structures from typical basic elements placed along spatial curves, such as pipes and tubes at an oil refinery, for example.

World Spline Graph Applications

A spline graph is determined by a set of points p0, p 1, ... p n and a set of edges or segments (cubic Bezier splines), that connect some or all of these points.

Each segment is determined by a starting (pSTART ) and an ending (pEND ) point, as well as tangent vector coordinates at these points, which determine the curvature of the segment (tSTART and tEND respectively). Points, that are shared by more than two segments are called junctions.

Source nodes (currently Static Mesh, Skinned Mesh, and Projected Decal) can be placed at points and along the segments of the spline graph. Each point and segment can have a single or a set of source nodes assigned. One of the following modes can be selected for each individual source node assigned to a segment:

  • stretching - source nodes are stretched along the spline segment.
  • tiling - source nodes are duplicated along the spline segment.
  • adaptive (a combination of the first two) - source nodes are duplicated along the spline segment, but the length of each node (stretching) is determined by the curvature of the corresponding part of the segment. Thus, long nodes are placed along the straight parts of segments, while short ones - along the curved parts, providing a reasonable balance between the plausible look and performance.
For example, a segment can have two source nodes assigned: one representing the road (stretched) and another for roadway lights (tiled with a gap).

Notice
Source nodes to be assigned to segments and points are stored in *.node files. The node file should contain a Static Mesh, Skinned Mesh, or Projected Decal as a root node.

An arbitrary number of WorldSplineGraph nodes can be added to the scene as it uses a number of optimizations (such as baking elements into large segments etc.) to ensure acceptable performance for large areas.

Coordinates of the UP vector are additionally stored for each point of the segment. This vector is used to define orientation of nodes placed along the segments of the spline graph. By default this vector is parallel to the Z axis. The UP vector does not affect the curvature of the spline segment itself.

UP vector adjustment.

SDK includes the Road Tool Constructor add-on with a set of ready-to-use assets (road segments and various types of junctions) that can be used as construction elements to simplify roads creation.

Notice
WorldSplineGraph node currently has the following restrictions:

See also#

  • The WorldSplineGraph class article to learn how to manage world spline graphs via API.
  • The SplinePoint class article to learn how to manage spline graph points via API.
  • The SplineSegment class article to learn how to manage spline graph segments via API.
  • C++ sample for the WorldSplineGraph class illustrating how to manage spline graphs and generate geometry along the graph segments: source/samples/Api/Nodes/WorldSplineGraph.
  • Samples illustrating use cases of the WorldSplineGraph node included in the Samples suite:
    • world_spline_graph/roads - roads created on the terrain surface.
    • world_spline_graph/ropes - ropes, chains and cables.

Creating a World Spline Graph#

To create a new world spline graph, do the following:

  1. Add a World Spline Graph node: on the Menu Bar, choose Create -> Spline Graph.

  2. Specify a name of existing spline file (*.spl) to be used for the new world spline graph or a new name to create your spline from scratch.

    Notice
    Remember, *.world files store only WorldSplineGraph node's data (transformation, list of source nodes, etc.), while spline graphs themselves are stored in separate *.spl files. To save the spline graph that you created in the world, click Save Spline in the Parameters tab and specify a file name for it.
  3. Edit the spline graph by managing its points and segments.
  4. Assign desired source nodes to points and segments of the spline graph.

Managing Points#

Adding a New Point#

New points are added to the spline graph by cloninng existing ones. To add a new point do the following:

  1. Select the world spline graph.
  2. Select the desired point, which you to clone (Move manipulator will appear).
  3. Press Ctrl + D on the keyboard (a new point will be created).
  4. Use the Move manipulator to position you new created point.

Adjusting Point's Position#

To adjust position of a point do the following:

  1. Select the world spline graph.
  2. Select the desired point (Move manipulator will appear).
  3. Use the Move manipulator as you would do to move a node.

You can also adjust the position of the selected point via the Spline Points section of the Parameters tab:

Adjusting Point's Tangent#

Tangents control the curvature of the spline segment. To adjust tangent at a point do the following:

  1. Select the world spline graph.
  2. Select the desired point (Move manipulator will appear).
  3. Select the desired tangent (in case the selected point is shared by multiple segments, several tangents will be displayed for it). As you select a tangent the Move manipulator appears next to it.
  4. Use the Move manipulator as you would do to move a node (the form of the corresponding segment will change).

Adjusting Point's UP Vector#

Up vector controls orientation of nodes placed along the spline segment. To adjust tangent at a point do the following:

  1. Select the world spline graph.
  2. Select the desired point (Move manipulator will appear).
  3. Select the desired UP vector (in case the selected point is shared by multiple segments, several UP vectors will be displayed for it).
  4. Switch to Rotate manipulator and use it to adjust the desired angle as you would do to rotate a node (the orientation of nodes placed along the corresponding segment will change).
    Notice
    You'll be able to see the effect only when a node is assigned to the corresponding segment.
  5. Use the Move manipulator as you would do to move a node (the form of the corresponding segment will change).

Merging Points#

Sometimes it might be necessary to merge certain points (e.g. to close a spline). To merge two or more points into one do the following:

  1. Select the world spline graph.
  2. Select points you want to merge with a region selection tool or one-by-one while holding the Shift key pressed.
  3. Right-click on a point you want to merge selected ones into and choose Merge To This Point.
  4. All points will be merged into one shared by the segments, to which the merged points belonged.

Deleting a Point#

To delete point(s) of the spline graph do the following:

  1. Select the world spline graph.
  2. Select point(s) you want to delete with a region selection tool or one-by-one while holding the Shift key pressed.
  3. Press the Del key.
Notice
You can only delete points, that do not belong to any segment.

Managing Segments#

Adding a New Segment#

To add a new segment to the spline graph do the following:

  1. Select the world spline graph.
  2. Select the starting point for the new segment to be added (Move manipulator will appear).
  3. Press and hold the Shift key and use the Move manipulator to position the ending point of the new segment.
    Notice
    • To create a straight segment, you should drag the manipulator in the direction of the tangent at the starting point.
    • The new added segment uses all settings (assigned nodes, placement modes and parameters) of the previous one.

You can also clone segment(s) by selecting them and moving with the Shift key pressed, or pressing Ctrl + D and placing the clone with the Move manipulator.

Deleting a Segment#

To delete segment(s) of the spline graph do the following:

  1. Select the world spline graph.
  2. Select segment(s) you want to delete with a region selection tool or one-by-one while holding the Shift key pressed.
  3. Press the Del key.
Notice
If you delete a segment that enters into a junstion the latter will cease to function properly.

Managing Source Nodes#

As described above, a single or a set of source nodes can be assigned to each point or segment of the spline graph.

Workflow for Segments#

To assign a source node to selected segment(s) do the following:

  • Select the desired segments(s).
  • Click Add Node in the Parameters tab.
  • In the window that opens, select the required node and click OK.

For each of the source nodes assigned to the selected segment(s) the following settings are available for adjustment via the Parameters tab:

Node Path to a *.node file containing a source node.
Forward Axis Defines which axis of the source node is to be oriented along the spline.
Placement Mode Type of objects to be generated. One of the following:
  • Stretch - a single source node instance is stretched along the segment.
    Notice
    This mode is the most performance-firendly.
  • Tiling - multiple instances of the source node are placed along the segment. The number of instances is determined by the sizes of the segment and the source node and the value of the Gap parameter.
  • Adaptive - a combination of the previous two resulting in multiple instances of the source node placed along the segment. Some of these instances may be stretched depending on segment's curvature.
Adaptive Threshold Determines how much a source node's instance can be stretched in the Adaptive placement mode to cover the whole length of the segment.
Notice
Available for Adaptive placement mode only.
UV Tiling Enables tiling of the source node's textures in the Stretch placement mode.
Notice
Available for Stretch placement mode only.
Gap Defines the gap (in units) between the adjacent instances on the source node for the Tiling placement mode.
Notice
Available for Tiling placement mode only.

Workflow for Points#

To assign a source node to selected point(s) do the following:

  • Select the desired point(s).
  • Click Add Node in the Parameters tab.
  • In the window that opens, select the required node and click OK.
    Notice
    For a junction point to behave properly an ObjectMeshSkinned node should be assigned, and the number of its bones should correspond to the number of spline segments connected to this point.

For each of the source nodes assigned to the selected point(s) the following settings are available for adjustment via the Parameters tab:

Node Path to a *.node file containing a source node.
Variant There is a number of possible variants for a junction. This slider enables you to choose the one that fits best.
Notice
This parameter affects only the source nodes representing junctions (ObjectMeshSkinned).

Junctions#

Junctions should interact with all entering segments properly providing seamless transitions. For this puprose ObjectMeshSkinned source nodes are used.

Source nodes to be used for junctions must comply with the following requirements:

  • Joints of a junction in the UnigineEditor must have their Y axes oriented from the center of the junction to the edges of the corresponding branches.
  • Outer joint of each junction’s branch must be placed exactly at the center of its outer edge, weights for outer vertices of the branch must be maximal for the outer joint (i.e., outer vertices of the branch are affected only by the outer joint).
  • As junction and segment are represented by separate meshes, textures and their UV maps must ensure seamless junction-segment and segment-segment transitions.
  • A segment may have junctions at both of its endpoints, Therefore the texture used for the segment must be symmetrical, at least its edges.
  • Specific requirements for roads:
    • A junction as well as a road segment must be represented by a pair of meshes (embankment and the road itself). Embankment mesh is used for smooth blending with terrain surface. Just enable the Terrain Lerp state for the material assigned to embankment.
    • To ensure correct deformation of segments and junctions triangulation for the road and embankment must match. This prevents penetration of meshes into each other when moving spline points up and down.
Last update: 2018-12-28
Build: ()