Descriptions and Examples for the POV-Ray Raytracer by Friedrich A. Lohmüller
    Model Railroading / Railway Modelling with POV-Ray -
Italiano Italiano
Français français
Deutsch Deutsch

Home
- POV-Ray Tutorial

  Model Railroading
  Railway Modelling
  with POV-Ray
    Index of Content

  - Rail Track System
    for POV-Ray
    Basic Track Elements
    - Straight & Curved
    - Switches
    - Wye + 3Ways
    - Level Junctions

    - Simplified Using by
      RT_System_00.inc
      - Rail Tracks Elements
        with RT_System_00.inc

    - Track Layout with
      Model Scaled Tracks
      - H0 Scale Tracks
      - N Scale Tracks
      - Z Scale Tracks

    - Track Layout with
      scaled Tracks
      - Track Placement
     > Tracks Up & Down

    - Track Layout Examples
      - Simple cyclic
      - Simple eight

    - Download of the
      Rail Track System


                                                     
Tracks up and down
Track Layout Technics with scaled Tracks
   Tracks up and down

Tracks Up & Down
Demonstration with N scale tracksystem of geometry type A:

1) Straights and Curves Up and Down

Tracks up by shearing with
    Track_Up_00("NAME",STEP,GRADIENT_TYPE) macro

Here:
NAME the name of the track element to shear:
i.e. T_222, T_115, T_111, T_107, T_058, T_055, T_028,
T_R1_45, T_R1_30, T_R1_15, T_R2_45, T_R2_30, ...
STEP the value of the height difference in meter for N scale tracks.
GRADIENT_TYPE:
0 for simple upward (or down for negative STEP)
1 for splitted upward for smooth transition (only for T_222, T_115, T_111, T_107, and curves of the angles 45, 30 and 15 degrees.)
2 for splitted ending upward for smooth transition (only for T_222, T_115, T_111, T_107, and curves of the angles 45, 30 and 15 degrees.)

Note: Using shearing instead of rotation is not totally exact from a geometrical point of view. The vertical projection of a rotated track on the ground plane is shorter than the track (see: Pythagoras!)!
But this simplification makes it tremendously easier to design a track layout, because we don't need to calculate any changed length.
And for small gradients the difference is mostly smaller than the tolerance which we have with 'real' model tracks.
//----------------------------------------------//
#local Step_1 = 0.02;
object{ Track_Up_00("T_111",Step_1,0)
                  translate<0*L111,0*Step_1*N,0>}
object{ Track_Up_00("T_111",Step_1,0)
                  translate<1*L111,1*Step_1*N,0>}
//----------------------------------------------//

Sharp and smooth transition:
Building gradients with sharp edges at start and end isn't only an estetically non-optimal solution, it will also cause heavy problems in model railroading / railroad modelling for the train models.
To avoid this in POV-Ray track layouts we can use
the splitting GRADIENT_TYPE 1 (start) and 2 (end of gradient)
with ~ 1/2 of the average STEP in use.
//----------------------------------------------//
#local Step_1 = 0.0225;
object{ Track_Up_00("T_111", Step_1/2, 1)
                translate<0*L111,0.0*Step_1*N,0>}
object{ Track_Up_00("T_111", Step_1  , 0)
                translate<1*L111,0.5*Step_1*N,0>}
object{ Track_Up_00("T_111", Step_1/2, 2)
                translate<2*L111,1.5*Step_1*N,0>}
//----------------------------------------------//






Sharp and smooth transition
Tracks up by shearing with
Track_Up_00("NAME",STEP,GRADIENT_TYPE) macro











Sharp and smooth transition
Sharp and smooth transition

2) Curves up and down.
Special problem here: there is no function in POV-Ray to screw an object! So we cannot get a smooth transition for both rails by rotating or shearing the tracks.
Solution: we can split the curve elements to minimize the error!
Note: This is only relevant for the POV-Ray representation of gradients in curves!
'Real' model tracks normally make no problems there!
Instead of
//----------------------------------------------//
object{ Track_Up_00("T_L1_45",Step_1,0)
        Rotate_Around_Trans(<0,-0*45,0>,<0,0,R1>)
        translate<0,0*Step_1*N,0>}
object{ Track_Up_00("T_L1_45",Step_1,0)
        Rotate_Around_Trans(<0,-1*45,0>,<0,0,R1>)
        translate<0,1*Step_1*N,0>}
//----------------------------------------------//
Better: Using curves splitted in smaller angles:
//----------------------------------------------//
object{ Track_Up_00("T_L1_15",Step_1,0)
        Rotate_Around_Trans(<0,-0*15,0>,<0,0,R1>)
        translate<0,0*Step_1*N,0>}
object{ Track_Up_00("T_L1_15",Step_1,0)
        Rotate_Around_Trans(<0,-1*15,0>,<0,0,R1>)
        translate<0,1*Step_1*N,0>}
object{ Track_Up_00("T_L1_15",Step_1,0)
        Rotate_Around_Trans(<0,-2*15,0>,<0,0,R1>)
        translate<0,2*Step_1*N,0>}
object{ Track_Up_00("T_L1_15",Step_1,0)
        Rotate_Around_Trans(<0,-3*15,0>,<0,0,R1>)
        translate<0,3*Step_1*N,0>}
object{ Track_Up_00("T_L1_15",Step_1,0)
        Rotate_Around_Trans(<0,-4*15,0>,<0,0,R1>)
        translate<0,4*Step_1*N,0>}
object{ Track_Up_00("T_L1_15",Step_1,0)
        Rotate_Around_Trans(<0,-5*15,0>,<0,0,R1>)
        translate<0,5*Step_1*N,0>}
//----------------------------------------------//
Note: Splitting curve tracks (GRADIENT_TYPE 1 or 2) are only available for tracks with the curve angles 45°, 30° and 15°.
Splitting straight tracks are only available for the straight tracks T_222, T_115, T_111, and T_105.
For smoothest transition in curves we should use only 15° curve track segments!

For curved tracks we often need to turn tracks by an angle around the center of the curve by using the macro 'Rotate_Around_Trans( RotationVector, Center_of_Rotation )' from the include file 'transforms.inc'.
We can replace the long command
'Rotate_Around_Trans(<0, 1*15,0>,<0,0,-R1>)' by a shorter expression like
'RTyz( 1*15, -R1 )' by declaring the following macro:
//----------------------------------------------------//
#include "transforms.inc"
#macro RTyz( Y_Angle, Z_Distance )
 Rotate_Around_Trans(<0, Y_Angle,0>,<0,0, Z_Distance>)
#end
//----------------------------------------------------//
With this the above text is much shorter:
//----------------------------------------------//
object{ Track_Up_00("T_L1_15",Step_1,0)
        RTyz(-0*15,R1) translate<0,0*Step_1*N,0>}
object{ Track_Up_00("T_L1_15",Step_1,0)
        RTyz(-1*15,R1) translate<0,1*Step_1*N,0>}
object{ Track_Up_00("T_L1_15",Step_1,0)
        RTyz(-2*15,R1) translate<0,2*Step_1*N,0>}
object{ Track_Up_00("T_L1_15",Step_1,0)
        RTyz(-3*15,R1) translate<0,3*Step_1*N,0>}
object{ Track_Up_00("T_L1_15",Step_1,0)
        RTyz(-4*15,R1) translate<0,4*Step_1*N,0>}
object{ Track_Up_00("T_L1_15",Step_1,0)
        RTyz(-5*15,R1) translate<0,5*Step_1*N,0>}
//----------------------------------------------//
screw without smooth transition
Curve tracks screwed by shearing in y - without smooth transition
screw with more smooth transition
Curve tracks screwed by shearing in y - with smoother transition
screw with more smooth transition
Curve tracks screwed by shearing in y - with smoother transition

2) Turnouts/switches and other elements up and down.
Turnouts / switches, level junctions / crossings cannot be turned up or down by 'Track_Up_00(...)'!
For such track elements we need to use the POV-Ray shearing by matrix directly.
To do this easily we can use the following macro,
which shears an element of the x-length 'Shear_Len'
by a step value 'Step_Up'('+' or '-' in N scale values in meter) in y direction:
#macro Shear_Up(Shear_Len,Step_Up) //-----------//
 matrix<1,Step_Up*N/Shear_Len ,0,
         0,1,0, 0,0,1, 0,0,0>
#end // end of macro ---------------------------//

The example from the opposite image:
//----------------------------------------------//
#declare TD = Track_Distance;
object{ SW_L( SD_1) translate< 0*L111,0,0>}
object{ T_R9_15
        Rotate_Around_Trans(<0,-1*15,0>,<0,0, R9>)
                    translate< 0*L111,0,0>}
object{ T_111       translate< 1*L111,0,0>}
// tracks upward:
object{ Track_Up_00("T_111",Step_1,0)
        translate<2*L111,0*Step_1*N,1*TD>}
object{ Track_Up_00("T_111",Step_1,0)
        translate<2*L111,0*Step_1*N,0>}

object{ SW_R(SD_2) Shear_Up(L111,Step_1)
        translate<3*L111,1*Step_1*N,1*TD>}
object{ Track_Up_00("T_111",Step_1,0)
        translate<3*L111,1*Step_1*N,0>}

object{ Track_Up_00("T_111",Step_1,0)
        translate<4*L111,2*Step_1*N,1*TD>}
object{ SW_R(SD_3) Shear_Up(L111,-Step_1)
        rotate<0,180,0>
        translate<5*L111,3*Step_1*N,0>}
//----------------------------------------------//













shearing of turnouts
Shearing of turnouts / switches and other objects


top

© Friedrich A. Lohmueller, 2011
www.f-lohmueller.de