ZModeler2 Lesson#1: Splines and Surfaces.

From this point on, an "UV" and/or "UV-Mapping" will be mentioned. What is exactly UV and what UV-Mapping is, will be explained few later, since it requires much more experience than have been given in these lessons till this point.

Splines.

What is spline?

Spline is a curve line in 3D space. It's made of an ordered sequence of vertices called control points which are connected with curves.

Image on the right shows a spline made of five control points. The first control point is a so-called First vertex - this is where spline starts. Green lines with additional (non-enumerated) points are control vectors. Each control point on the spline can have two control vectors - they adjust shape of the curve before and after according control point. On the image control points #4 and #5 have no control vectors, so curve between point #3 and #4 is controlled solely by one of #3th control vector; curve between points #4 and #5 has degradated to simple line. The simpliest spline that can be created in ZModeler is a single point.

Splines can be closed or opened. Image above is an opened spline. Closed spline has a curve going from it's last control point to it's First Vertex.

Splines curve detalization is an amount of points between two sequent control points. Curve drawen between two control points is a polyline which resides on a detalization-points. Detalization can be set on per-point level (so different curves in a spline can have different detalization). To change detalization of a curve, you need to change detalization value of the control point where this curve starts. In manipulators level, right-click on a control point and pick Properties... Image on the right shows where detalization can be set. Image on the left shows spline curve with different detalization set on first vertex. I've drawen bright red dots on the curve to show these detalization points. They are not drawen by ZModeler.

Besides detalization, ID and UV/User Float values can be set on each control point. These values are used by surface-creation tools to assign IDs (or materials) to polygons and to generate UV for vertices respectively. This will be described later.

How to create a spline?

Create...
Spline...
Strip

This is an interactive spline creation tool. With this tool selected, click in the view and you start creation of spline. Move mouse aside and click again, then move cursor somewhere elese and click once again. Finally, right-click when done. You have created a poly-line spline. Now we shall create a curved spline. Start creating new spline as described above, but make sure to "click and drag" instead of simple "click" when creating any (or all) points. You will see a dashed line and curves between points you've created. When done creating spline, right-click and switch spline to Manipulators level. You will see how spline was actually created. Each "click"-point is a generic control point while "click and drag" points have control vectors. When you dragged the mouse, you have (internally) specified where these control vector points to and how vertices (incoming and outgoing) curves are shaped.

You can Move manipulators with Modify\Move tool. When you get used how control vectors affect curve shape, you will get used how to intially create spline properly.

Create...
Spline...
Circle

Creates an elliptic (or circle) closed spline. Additional settings box for this tool contains the following options: Vertices is an amount of spline's vertices to create in the circle; Smooth curve and Segments is an option for creating smooth curve, since by default this tool creates vertices laid on a circle and connected with straight lines, not a curves. Segments is an amount of detalization vertices on each curve - more on detalization will follow below. To create a circle spline, press left mouse button and drag mouse aside (you define center and radius of circle spline). By default, ellipse will be drawn - you can hold to create circle. Release button and spline will be created.

Create...
Spline...
Helix

Creates a helix (spring) spline. Additional settings for this tool match the settings for Circle tool and contain one more option: Steps which is an amount of spring rounds. Creation of helix is exactly the same as creation of circle spline. Height of helix will be the "steps times radius" (e.g. If radius is 1.0 and 3 steps were set - height of each step will be 1.0 and height of whole helix will be 3.0). You can scale spline to get the height you need later.

How to modify a spline?

Curve shape and control points.

The most commonly used way to modify spline is to switch it to manipulators level and drag manipulators with Modify\Move tool. The next modification you will commonly use is changing control point type.

You can change type of each point in context menu. Right-click on desired control point and pick type of the point in context menu under Type branch.

If you try to highlight a control point's manipulator, but it doesn't chage it's color, then you have a manipulator for control vector under cursor (one manipulator is drawen over another and you see no visual changes). In such a case move the thing that is actually highlighted aside a little and then you can access manipulator you want. The same situation addresses to context menu: if it does not contain "Type" branch, then you have clicked on control vector's manipulator.

Refining spline shape.

You can delete control points with Modify\Delete tool. New points can be added with Modify\Insert tool on manipulators level. Newly inserted points do not affect shape of spline curves - manipulators are adjust the way to avoid spline shape distortion:

Modify\Break tool applied to control-point manipulator will break spline apart in this point. If spline was closed, the control point you've clicked on will become it's First Vertex and end-point will be created at the same position (you can drag it out with Move tool). When using Break on open spline, spline will interrupt in this point and new spline will be made of it's tail:

Modify\Connect can connect head and tail control-points of the same spline to make it a closed spline. When several splines switched to manipulator level, this tool can connect one spline to another and form single spline out of two splines (you can connect head/tail points of splines only: you can't connect to any intermediate point; closed splines can not be used too):

Create\Spline\Strip can continue existen spline. Simply, when you start creating new spline from head or tail point of any other spline, a message box will popup:

If you pick "Continue this spline" in such a case, the tool will continue creation of the spline you've clicked on. If you have clicked on First vertex, spline order will be flipped (it's tail will become first vertex and first vertex will become a tail - you will add vertices from this point from the moment).

The "spline order flip" described above is the process when "tail vertex" becomes "First vertex". In certain cases this operation needs to be performed (when spline is a path that some object should follow, but spline is backward-oriented). This spline "reorder" is done on manipulators level. In context menu for the last (tail) point, there is an Edit/Make First option which does this trick.

Surfaces.

You have learned basic grid surface creation already and now a run of a bit more complex surfaces. They are, in general, all the same - a mesh object made of quads or triangles, but the way they are created - differs. Here two types of surfaces will be introduced - surfaces made out of spline(s).

Revolved surface.

Revolved surface (or "surface of revolution") is made out of a cross-section spline which is rotated around one of it's local axis. When capping is on, result surface will form a solid object without holes.

Create...
Surface...
Revolved

This tool is used to create revolved surface out of spline. It creates a surface out of the spline you click on. Before using this tool, take a look at it's options box. The first thing you should pay attention to is "Revolve axis" - here you specify which axis spline will rotate around.

This tool always uses spline's local axes, so in "Revolve axis" you should specify spline's local axis. Make sure to position local axes properly before revolving spline (Modify\Move tool with "Pivot only" option set On can be used).

The next important option is Sections. This is how many times spline-cross- section will appear while revolving a round (360 degrees).
Sharp Corners specify whether result surface will produce sharp line out of Corner and Bezier-corner points. Image on the left shows two revolved surfaces made of the spline on the right (notice that spline's local axes are moved a little away from the spline itself). The left surface was created with "sharp corners" set on and "cap start" set off (notice sharp shading under bright red highlight on the left object). The right surface was created with "sharp corners" off and "cap start" set on (notice smooth shading where left object have sharp shading, and notice a "circle of triangles" that caps the hole - it's under bright blue highlight).
U Repeat and V Repeat options are purely UV-mapping generation specific options. They set an amount of times texture will wrap along cross-section (U Repeat) and along the 360-degrees circle (V-Repeat). These values affect only when UV-mapping generation is set On in "Create\Surface" options box. Let's take a look it.

"Produce Triangles and Quads" is a self-explaining option. Other options are:

  • Generate UV - will enable UV generation for surface. When this option is set On: "U-Repeat", "V-Repeat" and "UV/User Float" values are used. The last one is defined on control-point level in its "Properties" box. When no "UV/User Float" values set for control-points, then cross-section assumed to have U-value spreaded linearly over it's length:
  • Assign Materials - will translate control point's "ID" values (set in their "Properties") to polygons zero-based material index.
  • Assign Props - will translate control point's "ID" values to polygons ID. These IDs can be used later in "Select\By ID" tool to select lanes of identical polygons in result mesh.
  • Optimize Spline - will perform spline detalization optimization. Set this option if you haven't defined each control points "Detail" value. When this option is set On, it can reduce surface complexity, since otherwise even linear spline segments (having a non-zero detail) will produce way too much vertices and polygons. If you have set each control point's detal level to desired value, you should uncheck this option.

    Finally, in half of cases result surface is flipped inside out and Modify\Flip should be applied.

    Loft surface.

    Loft surface is made out of a cross-section spline which goes along a path spline.

    Create...
    Surface...
    Loft

    Loft surfaces are a quite common case when creating track or landscape meshes. Lots of lanes, roads, side-walls are actually a "shape that goes along some path". These are exactly a cross-section that goes along path. When creating a track, you can create a cross-section of three segments (grass, tarmac, grass) and loft it over complex shapy path. Result will be a tarmac road going along the path and a grass on both sides. Image on the right is an example. Path-spline is a long shapy path of the road. Cross-section spline (switched to manipulator level on the image) is a cross-section. It's made of three linear segments: the first and the third segments have ID set to 1 (green), and the second segment's control point has ID set to 0 (gray). Color (green and gray) are purely an example (I have two materails - the first (0) is gray and the second (1) is green).

    To create a loft surface, you have to click on cross-shape spline first and then on path-spline. It's recommended to move cross-shape spline's First vertex near to path-spline's First vertex. On the right image they match exactly and you see only one "big point".

    Advanced settings box for this tool contrains the following optioins:

  • Const Stepping each <value> - will place cross-section on the path with value distance between cross-sections. By default, cross-section placed on control points and on detalization-points.
  • Sharp Corners and Mapping settings are the same as in Revolved surface options.
  • Locked axis is the cross-shape local axis which will stay locked (will not lean or turn in any way). For example, when path spline is drawn in Top view and cross-shape axes are the same as world axes, you can lock "Y-axis", so cross shape will spin around this axis only while following the path. By default, no locking requried and this is the option I've used when creating an example above.