Effect Layer Data Binding

From TrainzOnline
Revision as of 17:32, 5 March 2019 by Builderbob (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Each Effect Layer may have zero or more Effect Layer Data Bindings. Each data binding is a Surveyor-configurable value which affects how the effect layer appears to the user. Data bindings may be set to a constant value across the entire route, or may be painted using the appropriate Surveyor tools such that they vary at different locations on the route.

Effectlayerwindow1e.jpg

Effectlayerwindow1f.jpg

When configured to a constant value, the data binding consumes only a small, fixed amount of data in the route asset. There is minimal data cost from creating many effect layers each using constant values. It should be noted that the data cost here has minimal effect on performance; it is simply a question of how large the route asset will grow as new baseboards are added. It is important to keep the data size under control, but this is not a performance optimization. Constant values tend to be more appropriate for data bindings relating to colors, directions, etc. rather than for density bindings (as it is almost always the case that you will want to vary the density or presence of an effect across a route).

The data binding can alternatively be configured as a "per-grid" attribute. This is done by selecting a Density value other than 'Zero'. When you configure the data binding in the Effect Layer editing dialog, you may specify both the resolution of the grid and the precision of the value stored for each grid element. The higher the resolution or precision, the more space is required to store the values. The Effect Layer editing dialog may impose an upper limit on the amount of storage space available for layer bindings - once you reach the limit, you'll need to remove some bindings or reduce the data cost of some bindings before you can add any more. Configuring variable data bindings then becomes an optimization problem - where should you spend your limited amount of storage space in order to gain the best visual results? It is important to again keep in mind that storage optimization has minimal effect on performance; it is purely a visual tradeoff between the various possible uses of the available storage space.

Grid resolution controls how finely the data binding can be edited in Surveyor. Items lower in the list (lower values) represent greater resolution and higher data cost. For some effect layers, it may be adequate to only vary the effect over larger distances (eg. 40x40m squares) in which case a very low resolution is acceptable. This may be too limiting for certain effect types, especially if the effect is to be used in areas where the user is likely to get up close to the effect. For example, if a foliage effect is placed near the mainline with that kind of resolution, it may be difficult to prevent the foliage from overlapping the track, which might look inappropriate. Your options here might include keeping the foliage well away from the track (suitable for some types of foliage) or increasing the resolution available (eg. to 5x5m squares) such that you have finer control and can bring the foliage much closer to the track without inducing any overlap. This optimisation might involve creating multiple layers from the same assets with different density and resolution, suitable for different usages.

The data binding precision controls how many bits of data are used to store the binding's value at each grid location. The more bits of data that are used the greater control the user has over the appearance of the effect, but the greater the storage requirement for each baseboard in a route. In many cases, very low precision is acceptable. For example, one bit of precision (Int1) for a density value is sufficient to switch the effect on and off: an integer of size 1 can store values of 0 or 1, where 0 means the effect is not present and 1 means it is present. This may be appropriate for many types of foliage - you either want the effect present, or you don't. In other cases you might want a bit more control. An integer of size 4 (Int4) can store 16 values, but takes 4 times the storage space of Int1. Sixteen values for the effect means that it is possible to create gentle transitions and gradual adjustments. The "softer" that you need transitions to occur, the more likely that you'll need to increase the precision of the data. When you are applying an effect in a route it is useful to be aware of what data binding precision has been used in creating the effect, because the precision determines the amount of control you have. If you can't achieve the control you require then it may be necessary to adjust the precision of the layer.

Using the higher precision options is frequently unnecessary, and can be very expensive when used with high-resolution data. Where high precision is required for a particular effect it may be an acceptable trade-off to decrease the resolution of the data in order to offset the data cost of that higher precision. That is, the higher precision required for adjusting the effect can be obtained at the cost of lower control over the area that it is applied to.

Density Settings and Data Cost
Density Data Bits Range
Int1 1 0 - 1
Int2 2 0 - 3
Int3 3 0 - 7
Int4 4 0 - 15
Float16 16 0 - ~65,000
Float32 32 0 - ~3.4×10^38.
Personal tools