Modeling Splines

From TrainzOnline
(Difference between revisions)
Jump to: navigation, search
 
m (1 revision)

Revision as of 23:59, 3 February 2010

The second major primitive type in Trainz modelling is the "spline". Spline types are used for modelling continuous objects such as track, bridges, roads, hedges, fences and standalone walls. The route creator initially specifies a number of points along the spline. Trainz will then take the geometry that you supply, and bend it to fit a curve that travels through each of the points. Your model geometry may also be adjusted to take into account variations in the ground height, super-elevation, etc.

TBD: Image of single spline mesh, spline vertices, and how the mesh is bent around the vertices.


Contents

Orientation

Models built for spline objects start from the origin, and extend along the negative Y axis. Care needs to be taken to use exact measurements, to avoid seams and overlap issues. For each mesh, a length is specified in the spline asset's config.txt file. It is permissible to extend the mesh outside of the defined extends, deliberately causing overlap with the neighbouring models. Due to the exacting requirements for alignment and measurement, it is recommended that the modelling program's tools are used to enforce exact positioning of end vertices, rather than "doing it by eye."

TBD: Image of single spline mesh against axis lines.


Model Variations

When modelling for a spline object, several varations on the main mesh need to be created:

  • The first variation is the main high detail piece. It should be quite short, typically around 2m since if the route creator builds a very short spline, this piece will be scaled down to fit. As it's the high-detail object, it should use sufficient polygon and texel detail to make the object appear photo-realistic.
  • You may choose to make a few variations of the high detail piece, from which Trainz will choose one "at random." These should look similar enough that they can share the same lower-LOD piece.
  • The next few variations represent the same object, but increase the length and decrease the number of polygons. The lowest detail pieces should not bother with short lengths but instead provide extended (40m-100m) pieces. The mid detail pieces should provide a range between short (5m) and long (20m.)
  • End-caps are usually desired to "seal off" the geometry. The individual spline models should not be capped at the ends, and any ground-based spline (such as track) should not have any "floor" polygons. These areas generally won't be visible, so there's no point in wasting polygons on them. The end-caps are used at the very start and very end of the spline, to prevent 'holes' being visible. Typically these are only used at high to mid detail, since the holes aren't going to be visible in the far distance.


Bending

Trainz can only bend the model geometry at existing vertices, it will not add new vertices. When you need to add vertices to a given polygon in the model, you should add vertices to all polygons at that Y position - if you fail to cut the polygons at roughly the same Y position, you will find that the polygons bend at different times and the model splits apart around tight curves.

TBD: Image of correct and incorrect vertex placement wrt/ bending the model.

When considering the length of your model, be aware that by adding regular divisions along the Y axis, you can allow the model to bend cleanly without requiring short model lengths. This is more efficient than using a shorter model and having it repeat more often. However, if the route creator lays a short spline, and no short model is available, Trainz will scale the model along the Y axis - if the scaling factor is excessive, poor visuals may result.


Symmetry

Symmetry across the X-axis at the start and end of a spline model are not strictly required, however this is recommended wherever the spline could be used to form a 'ρ' shape. Single-line splines, loops, and 'Y' joints do not require symmetry, however the layout creator must then lay the spline in an appropriate direction so as not to reveal the lack of symmetry. The 'ρ' shape (a circle containing a 'Y' junction) and other complex spline layouts may require symmetry in order to maintain correct visuals.

A basic rule of thumb is that Track splines require symmetry, whereas scenery spline generally does not. Where there is no significant reason to avoid it, a spline model should exhibit symmetry so that the route creator has less chance of introducing visual errors.

Symmetry is not required throughout the length of the model, only across the X-axis at the start (Y=0) and end (Y=max) of the model. A symmetric model is one that can be exactly (read: each vertex matches up) connected to a duplicate of itself end-to-end, and also to a 180° rotation of itself. If the model is not truly symmetric, the 180° variant will have vertices which do not exactly match, leading to seams and overlapping geometry.

If providing symmetry, the high to medium LODs are the most critical - as with end-caps, minor errors in the lower LODs are generally not visible. That said, the simplified geometry in lower LODs generally lends itself to symmetry anyway.


Materials

An efficient spline must share a single material between all meshes. This means that your asset will contain multiple meshes, but only one diffuse texture and one normal texture. Some meshes may reuse the same area on the texture, while other meshes may need a distinct area due to differences in the geometry. Typically the texture will not be set as tiling, and any tiling will be performed using the geometry - attempting to tile the texture will usually result in difficulties with fitting the multiple meshes onto the single texture page.

In order to enable material sharing, all meshes should use the same named material with the exact same material parameters. The easiest way to achieve this is to source all of the meshes from a single MAX file, where they use the same material. TBD: Link to page explaining how to do this.


Typical Polygon Counts

The following LODs are appropriate for a typical spline. While lesser polygon counts may be used where the detail is simply unnecessary, you should not sacrifice visible detail in order to reduce below these polygon counts. These polygon counts are selected as reasonable maximums - you should not significantly exceed these values.

TBD: Breakdown of recommended lengths and polygon counts.


Level Of Detail Tree

TBD: Best practices for using the KIND Track - how to build the LOD tree.


References

Personal tools