@@ -496,7 +496,7 @@ shape file and looking at the ``shader_names`` block near the top of the file. T
496496top of the list has an index of 0, the next one down has an index of 1, and so on. The accepted shader names are
497497``Tex `` (fullbright), ``TexDiff `` (diffuse lighting), ``BlendATex `` (fullbright with transparency), ``BlendATextDiff ``
498498(diffuse with transparency), ``AddATex `` (fullbright with x-ray transparency), ``AddATexDiff `` (diffuse with x-ray
499- transparency), if an invalid shader name is given a warning will be added to the log.
499+ transparency), and all are case-sensitive. If an invalid shader name is given a warning will be added to the log.
500500
501501For example, the US2BSignal2.s shape included with Marias Pass uses one shader, the ``TexDiff `` shader. This
502502disallows transparency. If, for any reason, transparency were desired on this shape, the shape descriptor file
@@ -615,6 +615,56 @@ for them to appear in the intended locations. The location of a sub object is me
615615so if the sub object parent is changed, it's position in the 3D world will change as well (unless corrected for,
616616as was done here).
617617
618+ Hiding Sub Objects
619+ ''''''''''''''''''
620+
621+ .. index ::
622+ single: ESD_ORTSObjectVisibility
623+
624+ In some cases, it may be desired to simply disable rendering of some shape sub objects (for example,
625+ preventing low-poly objects from being rendered so they can be replaced with higher-poly freight
626+ animations). To achieve this, ``ESD_ORTSObjectVisibility'' may be added to to the Shape ( block of the
627+ shape descriptor file. ``ESD_ORTSObjectVisibility ( MATRIXNAME 0/1 ) `` will take rendering of all
628+ sub objects controlled by the matrix called "MATRIXNAME" and make them visible if the second input is not 0,
629+ or invisible if the second input is 0. Note that 1 (the object is visible) is the default setting for all objects.
630+ If an object is set to be invisible, data for that object will not be sent to the GPU, saving render time,
631+ but any CPU calculations such as animations will still be applied to the sub object(s) and ``ORTSShapeHierarchy ``
632+ can still be used to attach lights, freight animations, sounds, particles, etc to the object while invisible.
633+ Similarly, anything attached to a different matrix (regardless if that matrix is above or below the one made
634+ invisible) will remain visible and simulated unless specified otherwise.
635+
636+ As an example, we can hide all the (low poly) wheels of an old locomotive in order to replace the wheels with
637+ (high poly) freight animations using the ORTSShapeHierarchy feature of :ref: `ORTS freight animations<orts-freight-anims> `::
638+
639+ SIMISA@@@@@@@@@@JINX0t1t______
640+
641+ shape ( SF_FP45_93.s
642+ ESD_Detail_Level ( 0 )
643+ ESD_Software_DLev ( 2 )
644+ ESD_Alternative_Texture ( 0 )
645+ ESD_Bounding_Box ( -1.632 -0.095 -10.99 1.684 4.628 10.99 )
646+
647+ Comment ( Disable rendering, but not simulation, of all wheels. )
648+ ESD_ORTSObjectVisibility (
649+ WHEELS11 0
650+ WHEELS12 0
651+ WHEELS13 0
652+ WHEELS21 0
653+ WHEELS22 0
654+ WHEELS23 0
655+ )
656+ )
657+
658+ Note that, similar to other parameters, multiple objects can be hidden in one parameter by adding additional
659+ pairs of matrix names and 1/0 values. If a matrix name can't be found, the missing matrix will be skipped and
660+ a warning will be added to the log.
661+
662+ This feature can also be used by freight animations directly using the ``ReplaceObject `` parameter; an ORTS freight
663+ animation with this parameter will disable rendering of the original object to which it is attached whenever the
664+ freight animation is visible. When used in combination with the ``ShapeHierarchy `` ORTS freight animation parameter,
665+ the freight animation can be used to effectively replace specific components of the original model without editing
666+ the .sd file. Users are encouraged to experiment with whichever approach works best.
667+
618668Transformation Matrix Name Changes
619669''''''''''''''''''''''''''''''''''
620670
@@ -826,6 +876,8 @@ Other Vehicles:
826876OR specific freight animations and pickups
827877------------------------------------------
828878
879+ .. _orts-freight-anims :
880+
829881General
830882'''''''
831883
@@ -889,6 +941,7 @@ the first line of the include file must be blank.::
889941 MaxHeight ( 0.3 )
890942 MinHeight ( -2.0 )
891943 FreightWeightWhenFull ( 99t )
944+ ReplaceObject ( 0 )
892945 FullAtStart ( 0 )
893946 )
894947 FreightAnimContinuous (
@@ -902,6 +955,7 @@ the first line of the include file must be blank.::
902955 MaxHeight ( 0.3 )
903956 MinHeight ( -2.0 )
904957 FreightWeightWhenFull ( 99t )
958+ ReplaceObject ( 0 )
905959 FullAtStart ( 0 )
906960 )
907961 )
@@ -1009,6 +1063,12 @@ moment. The parameters of the subblock are described below:
10091063- ``FreightWeightWhenFull `` defines the mass of the freight when the wagon is full;
10101064 the mass of the wagon is computed by adding the mass of the empty wagon to the
10111065 actual mass of the freight
1066+ - ``ReplaceObject `` if set to 1 (ignored if missing) will disable rendering of the wagon
1067+ sub object to which the freightanim is attached. This works best when combined with
1068+ ``ShapeHierarchy `` to disable rendering of specific sub objects, effectively replacing
1069+ the sub object graphic with that of the freightanim. The intended use of this setting
1070+ is to "delete" original shape parts and replace them with higher quality shapes without
1071+ editing the original shape.
10121072- ``FullAtStart `` defines wether the wagon is fully loaded ( 1 ) or is empty at game
10131073 start; if there are more continuous OR freightanims that have ``FullAtStart ``
10141074 set to 1, only the first one is considered.
@@ -1095,6 +1155,7 @@ freightanims. The ``FreightAnimStatic`` subblock has the following format::
10951155 Flip ()
10961156 ShapeHierarchy ( MATRIXNAME )
10971157 Visibility ( "Outside, Cab2D, Cab3D" )
1158+ ReplaceObject ()
10981159 )
10991160 )
11001161
0 commit comments