@@ -411,6 +411,121 @@ some steps of the content creation process or allow more control over content th
411411possible. The goal of these features is to save content creators' time, give additional power to
412412creators, and to simplify the installation process for end users.
413413
414+ Runtime shape manipulation
415+ --------------------------
416+
417+ .. _features-shape-manipulation :
418+
419+ MSTS shape files can be clunky to work with due to the proprietary nature of the file format
420+ and the limitations of the tools available to manipulate them. Even when a shape has been
421+ manipulated, it's often not appropriate to redistribute those changes (unless the end user
422+ is to replicate the manipulation themselves) to avoid plagarism. To improve this, OR now
423+ supports additional ways to manipulate shape file data in memory without editing the original
424+ shape.
425+
426+ These features use the shape descriptor (.sd) file to provide the information needed to change
427+ the shape file data at runtime. The .sd file can be edited in plain text in standard text editors,
428+ and there is no risk of plagarism when including .sd files in a download, so changes can be
429+ made and distributed easily. However, it may be desired to use a different .sd file than the
430+ default one (the .sd default file has the same name as the .s file) out of a desire to not overwrite
431+ the original, or to re-use the same shape file repeatedly with different data, saving file space.
432+ To facilitate this, most places in wagons and engines where a .s file can be specified now accept
433+ an additional input to *specify a different .sd file than the default *.
434+
435+ For example, ``WagonShape ( "dash9.s" "dash9_reskin.sd" ) `` would load the dash9 shape, but
436+ instead of loading dash9.sd, would load dash9_reskin.sd and apply any settings in that alternate .sd file.
437+ Similar can be applied to ORTS freight animations (not MSTS freight animations), passenger views,
438+ 3D cabs, and animated couplers. Note that both the .s and .sd file specified can be
439+ in a different folder from the .eng or .wag by using relative file paths. If only the .s file is
440+ given, OR will assume the .sd file has the same name as the given .s file, just like MSTS. OR does
441+ not require .sd files to function, so if the .sd file is missing OR will continue with default settings.
442+
443+ While .sd file replacement is currently unique to engines and wagons, the new features inside .sd files
444+ can be applied to any .sd file, including scenery.
445+
446+ .. index ::
447+ single: ESD_ORTSTextureReplacement
448+
449+ Texture Replacement
450+ ^^^^^^^^^^^^^^^^^^^
451+
452+ Perhaps one of the most useful additional shape descriptor features is the ability to replace the
453+ textures used by a shape without editing, copying, or even moving the shape file. To achieve this,
454+ add the ``ESD_ORTSTextureReplacement `` parameter to the .sd file, and enter texture names in the
455+ format ``ESD_ORTSTextureReplacement ( OriginalTexture.ace ReplacementTexture.ace ) ``. Any
456+ OriginalTexture not specified won't be changed, and if the shape doesn't have a texture specified,
457+ then a warning message is produced. This works with both .ace and .dds textures. Multiple
458+ textures can be replaced in one go by adding additional pairs of textures::
459+
460+ SIMISA@@@@@@@@@@JINX0t1t______
461+
462+ shape ( BNSF_C44_9W_4614.s
463+ ESD_Detail_Level ( 0 )
464+ ESD_Alternative_Texture ( 0 )
465+ ESD_Bounding_Box ( -1.632 -0.095 -11.05 1.684 4.628 11.05 )
466+ ESD_ORTSTextureReplacement (
467+ "BNSF_C449W_4410a.dds" "BNSF_C449W_4614a.dds"
468+ "BNSF_C449W_4410b.dds" "BNSF_C449W_4614b.dds"
469+ )
470+ )
471+
472+ This would reskin BNSF 4410 into BNSF 4614 without any need to edit the original shape. Remember
473+ to reference the original .s file, but with a custom .sd file ``WagonShape ( "..\\BNSF_MULLAN_GE_ENGINES\\BNSF_C44_9W_4410.s"
474+ "BNSF_C44_9W_4614.sd" ) `` so that the original shape file doesn't need to be copied. It is recommended
475+ that content creators making multiple skins of a new model, or reskinning an existing model, use this
476+ method to provide different textures for different engines/wagons as only one copy of the shape file is
477+ needed, reducing install size and simplifying installation as users don't need to move/copy/edit any
478+ shape files.
479+
480+ Translation Matrix Modification
481+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
482+
483+ All shape files are organized into one or more *sub objects *, where each sub object is positioned/scaled/rotated
484+ relative to the other sub objects using a *transformation matrix *, which are the named parts of the
485+ shape that can be seen in shape viewing utilities. A consequence of this is that the
486+ position/scale/rotation of a sub object can be changed without changing any of the 3D data used
487+ to draw the sub object. This can be useful to correct errors in the position/scale/rotation
488+ of the whole, or part of, a model without changing a tremendous amount of data.
489+
490+ .. index ::
491+ single: ESD_ORTSMatrixTranslation
492+ single: ESD_ORTSMatrixScale
493+ single: ESD_ORTSMatrixRotation
494+
495+ - To change the position of a sub object, use ``ESD_ORTSMatrixTranslation ( MATRIX x y z ) `` where
496+ ``MATRIX `` is the name of the matrix and ``x y z `` are respectively the +right/-left, +up/-down,
497+ and +front/-back offsets from the original position, measured in units of distance (meters by default).
498+ - To change the scale (size) of a sub object, use ``ESD_ORTSMatrixScale ( MATRIX x y z ) `` where
499+ ``MATRIX `` is the name of the matrix and ``x y z `` are the horizontal, vertical, and lengthwise
500+ scale factors from the original scale. Scale factors larger than 1 increase size in that dimension,
501+ between 0 and 1 reduce size, and negative scale factor mirrors the object in that dimension.
502+ - To change the rotation of a sub object, use ``ESD_ORTSMatrixRotation ( MATRIX y p r ) `` where
503+ ``MATRIX `` is the name of the matrix and ``y p r `` are the yaw (+left/-right), pitch (+up/-down)
504+ and roll (+ccw/-cw) angle change from the original rotation, measured in radians by default. The ``deg ``
505+ unit suffix can be used to give angles in degrees.
506+
507+ Only one of each type of parameter can be provided for each matrix. If all 3 transformations are
508+ applied to a matrix, they will be applied in the order of *translation, scale, then rotation *.
509+ An important consideration when manipulating these properties of transformation matrices is that
510+ the transformation will also be applied to any sub objects *below * the current matrix in the hierarchy.
511+ The transformation also affects 3D interiors, particle emitters, lights, and sounds attached to any
512+ affected sub objects.
513+ Should the transformation be desired only for something higher in the hierarchy, an equal but opposite
514+ transformation would be required on the lower-level sub object. It should also be considered that
515+ changes made to matrices are not purely graphical and could have consequences with some simulation
516+ systems. Extreme settings may break simulation behavior.
517+
518+ .. index ::
519+ single: ESD_ORTSMatrixRename
520+
521+ The name of the transformation matrix is itself important for simulator behaviors, particularly
522+ animations and determining the structure of rolling stock. Should a matrix be named incorrectly,
523+ or a change in behavior be desired, a matrix can be renamed using ``ESD_ORTSMatrixReanme ( OLDNAME NEWNAME ) ``
524+ in the .sd file. OR will scan for any matrix "OLDNAME" and change the name to "NEWNAME". If no
525+ matrix with the old name can be found, a warning will be produced and nothing will change. Note
526+ that the matrix rename step occurs *after * the previously described matrix modifications, so
527+ the old matrix name must be used by any other .sd parameters that require a matrix name.
528+
414529Automatic wagon size calculation
415530--------------------------------
416531
@@ -427,7 +542,9 @@ To simplify this process, and produce more reasonable dimensions for rolling sto
427542automatically calculate the dimensions of rolling stock based on the shape file used. Enter
428543``ORTSAutoSize `` in the Wagon section of an engine or wagon to allow OR to determine
429544the width, height, and length of the rolling stock based on the dimensions of the main shape file,
430- ignoring any values entered manually in the MSTS Size parameter.
545+ ignoring any values entered manually in the MSTS Size parameter. Note that this process is
546+ not aware of any :ref: `shape descriptor overrides <features-shape-manipulation >` so any changes made
547+ to the shape there will not be reflected in the automatically calculated size.
431548
432549``ORTSAutoSize `` accepts 3 (optional) arguments, default units in meters, corresponding to offsets from the
433550shape's width, height, and length respectively. For example, ``ORTSAutoSize ( 0.1m, -0.2m, -0.18m ) ``
@@ -1157,6 +1274,7 @@ Here below a sample of a ``.load-or`` file::
11571274 {
11581275 "Name" : "triton",
11591276 "Shape" : "COMMON_Container_3d\\Cont_40ftHC\\container-40ftHC_Triton.s",
1277+ "ShapeDescriptor" : "COMMON_Container_3d\\Cont_40ftHC\\container-40ftHC_Triton.sd",
11601278 "ContainerType" : "C40ftHC",
11611279 "IntrinsicShapeOffset": [0,1.175,0],
11621280 "EmptyMassKG": 2100.,
@@ -1167,7 +1285,10 @@ Here below a sample of a ``.load-or`` file::
11671285- "Container" is a fixed keyword.
11681286- "Name" has as value a string used by Open Rails when the container must be indentified in a message
11691287 to the player.
1170- - "Shape" has as value the path of the container shape, having ``Trainset `` as base.
1288+ - "Shape" has as value the path of the container shape (.s) file, having ``Trainset `` as base.
1289+ - "ShapeDescriptor" has the path of the container shape descriptor (.sd) file,
1290+ having ``Trainset `` as base. This is optional; if missing OR assumes the shape
1291+ descriptor is in the same location with the same name as the shape file.
11711292- "ContainerType" identifies the container type, which may be one of the following ones::
11721293
11731294 * C20ft
0 commit comments