HowTo/Create a Fence Spline Featuring LOD and Random Meshes

From TrainzOnline
< HowTo(Difference between revisions)
Jump to: navigation, search
m (Added cdp file)
(Work in progress - added some images and table data)
Line 1: Line 1:
 
This [[HowToGuides|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.
 
This [[HowToGuides|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.
 
The asset is an example only.
 +
 +
 +
:::[[File:LOD-random-bias-fence-spline-3-rows.jpg]]
  
 
=Purpose=
 
=Purpose=
Line 13: Line 16:
 
=Fence Spline=
 
=Fence Spline=
  
Notes:
 
 
* The asset is a 5-strand barbed-wire fence with post-and-batten construction.  
 
* 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;
 
* For demonstration purposes, the various meshes have been marked to indicate which variant and LOD level is visible;
Line 25: Line 27:
  
 
* 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.
 
* 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.
 +
 +
 +
This image 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%.
 +
 +
:::[[File:LOD-random-bias-fence-spline-4-rows.jpg]]
 +
 +
* This image shows the two lowest LOD levels: LOD1 and LOD2.
 +
 +
:::[[File:LOD-random-bias-fence-spline-2-LODs-visible.jpg]]
 +
 +
* This image shows all three LOD levels. 
 +
 +
:::[[File:LOD-random-bias-fence-spline-3-LODs-visible.jpg]]
 +
 +
== Comments on randomness of fence sections ==
 +
 +
*  The LOD-random-bias tag for this asset is set for 0.5 and it could be expected that the allocation of the two main meshes used would be about 50% for each.  A test of 30 fence rows of 10 sections for a total of 300 sections gave the following results:
 +
 +
{| class="wikitable"
 +
|-
 +
! Row !! Squares !! Triangles
 +
|-
 +
| 1 || 5 || 5
 +
|-
 +
| 2 || 8  || 2
 +
|-
 +
| 3 || 6 || 4
 +
|-
 +
| 4 || 1 || 9
 +
|-
 +
| 5 || 9  || 1
 +
|-
 +
| 6 || 0 || 10
 +
|-
 +
| 7 || 5 || 5
 +
|-
 +
| 8 || 2  || 8
 +
|-
 +
| 9 || 5 || 5
 +
|-
 +
| 10 || 7 || 3
 +
|-
 +
| 11 || 4  || 6
 +
|-
 +
| 12 || 8 || 2
 +
|-
 +
| 13 || 9 || 1
 +
|-
 +
| 14 || 8  || 2
 +
|-
 +
| 15 || 10 || 0
 +
|-
 +
| 16 || 5 || 5
 +
|-
 +
| 17 || 8  || 2
 +
|-
 +
| 18 || 9 || 1
 +
|-
 +
| 19 || 4 || 6
 +
|-
 +
| 20 || 0  || 10
 +
|-
 +
| 21 || 9 || 1
 +
|-
 +
| 22 || 1 || 9
 +
|-
 +
| 23 || 9  || 1
 +
|-
 +
| 24 || 8 || 2
 +
|-
 +
| 25 || 10 || 0
 +
|-
 +
| 26 || 8  || 2
 +
|-
 +
| 27 || 7 || 3
 +
|-
 +
| 28 || 8 || 2
 +
|-
 +
| 29 || 3  || 7
 +
|-
 +
| 30 || 7 || 3
 +
|-
 +
| Totals || 183 || 117
 +
|}
  
  
Line 223: Line 310:
  
  
(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
 
  
  

Revision as of 18:48, 8 May 2014

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.


LOD-random-bias-fence-spline-3-rows.jpg

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

  • 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.


This image 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%.

LOD-random-bias-fence-spline-4-rows.jpg
  • This image shows the two lowest LOD levels: LOD1 and LOD2.
LOD-random-bias-fence-spline-2-LODs-visible.jpg
  • This image shows all three LOD levels.
LOD-random-bias-fence-spline-3-LODs-visible.jpg

Comments on randomness of fence sections

  • The LOD-random-bias tag for this asset is set for 0.5 and it could be expected that the allocation of the two main meshes used would be about 50% for each. A test of 30 fence rows of 10 sections for a total of 300 sections gave the following results:
Row Squares Triangles
1 5 5
2 8 2
3 6 4
4 1 9
5 9 1
6 0 10
7 5 5
8 2 8
9 5 5
10 7 3
11 4 6
12 8 2
13 9 1
14 8 2
15 10 0
16 5 5
17 8 2
18 9 1
19 4 6
20 0 10
21 9 1
22 1 9
23 9 1
24 8 2
25 10 0
26 8 2
27 7 3
28 8 2
29 3 7
30 7 3
Totals 183 117


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"
   }
 }
}



Downloads

(TBD) A copy of the demonstration is available from the link below.

File:Kuid 68213 37900 Post and batten fence (demonstration).cdp

Personal tools