HowTo/Create a Fence Spline Featuring LOD and Random Meshes
This How-to guide shows how lod-random-bias can be used to introduce visual variation into a spline for use as scenery in Surveyor. The asset is a barbed wire fence with end posts. To demonstrate mesh variation, each section (track part) has a square or triangular marker. To demonstrate LOD level the marker is red for the highest LOD detail, yellow for the medium level detail or green for the lowest level detail. The asset is an example only.
Contents |
Purpose
This example shows how lod-random-bias can be used to introduce visual variation into a spline. Two variants of the repeating unit appear in the spline at random as the fence is laid out. In addition, a 3-tiered LOD scheme has been implemented on each mesh variant (and both end-caps).
Acknowledgements
The demonstration asset is provided by Trainz content creator Dinorius_Redundicus (Deane) for education purposes. Please respect his copyright.
Working Version
A working equivalent of this asset - without the visual markers - will be made available on the Download Station as 'Post and batten fence 01' <kuid2:68213:37066:2>."
Fence Spline
Notes:
- The asset is a 5-strand barbed-wire fence with post-and-batten construction.
- For demonstration purposes, the various meshes have been marked to indicate which variant and LOD level is visible;
- Variant 1 (triangle markers).
- Variant 2 (square markers).
- High-poly, LOD0 (red markers).
- Medium-poly, LOD1 (yellow markers).
- Low-poly, LOD2 (green markers).
- LOD transitions occur at 15m and 70m. The transitions and textures have been designed to offset the blurring of fence wires caused by 'mip mapping' - the automatic use by Trainz of low-resolution textures at long view distance.
Config.txt
The mesh-table, track, endcap-next and endcap-prev containers are shown below.
mesh-table { main-lod0 { mesh "main_lod0.im" } main-lod1 { mesh "main_lod1.im" } main-lod2 { mesh "main_lod2.im" } main2-lod0 { mesh "main2_lod0.im" } main2-lod1 { mesh "main2_lod1.im" } main2-lod2 { mesh "main2_lod2.im" } end-next-lod0 { mesh "end_next_lod0.im" } end-next-lod1 { mesh "end_next_lod1.im" } end-next-lod2 { mesh "end_next_lod2.im" } end-prev-lod0 { mesh "end_prev_lod0.im" } end-prev-lod1 { mesh "end_prev_lod1.im" } end-prev-lod2 { mesh "end_prev_lod2.im" } }
track { mesh-length 10 adjust-cross-section-to-ground 0 track-lod-tree { lod-random-bias 0.5 high-detail { subdivisions 1 lod-distance 70 high-detail { lod-distance 15 high-detail { mesh "main-lod0" } low-detail { mesh "main-lod1" } } low-detail { mesh "main-lod2" } } low-detail { subdivisions 1 lod-distance 70 high-detail { lod-distance 15 high-detail { mesh "main2-lod0" } low-detail { mesh "main2-lod1" } } low-detail { mesh "main2-lod2" } } } }
endcap-prev { mesh-length 10 adjust-cross-section-to-ground 0 track-lod-tree { lod-distance 70 subdivisions 1 high-detail { subdivisions 1 lod-distance 15 high-detail { mesh "end-prev-lod0" } low-detail { mesh "end-prev-lod1" } } low-detail { mesh "end-prev-lod2" } } }
endcap-next { mesh-length 0.1 adjust-cross-section-to-ground 0 track-lod-tree { lod-distance 70 subdivisions 1 high-detail { subdivisions 1 lod-distance 15 high-detail { mesh "end-next-lod0" } low-detail { mesh "end-next-lod1" } } low-detail { mesh "end-next-lod2" } } }
(TBD)
Image 1
This images show four lengths of the asset. The two fences at the rear consist of one segment and differ in three of the eleven (things) which is about 27% variation. The second closes fence consists of two segments and the closest consists of four segments. There are twelve sections and in this case nine of the twelve are different for a variation of 75%.
(TBD) Image 2
Downloads
(TBD) A copy of the demonstration is available from the link below.