- [WJ-R]: 1980s object removal
- [XCS]: Pending
- [UkTrainSys]: v0.3.2.0 released
- [Object Library]: Preparing...
- [Website]: Fifth version of website launched
My openBVE videos and other comments from users and myself can also be found via my YouTube channel.
Blog and Progress Updates
Transition curves and superelevated track created using the Object Bender tool, and Cross-City South v2.0 progress updatePosted by Anthony Bowden on 5th September 2010 at 7:30 am
I’ve been doing some more work on Cross-City South v2.0 during the past couple of weeks or so, and I’ve been making good use of odakyufan’s new Object Bender tool, where incidentally, the code was so well written and the functionality comprehensive enough, that Object Bender has been made into an official openBVE tool. Please see the new Object Bender section on the official openBVE homepage for more information: Developing for openBVE: Object Bender.
The output from the tool is such, that I’ve decided to replace all the curved track objects used in the Cross-City South route with new objects generated by Object Bender (from a set of “template” objects which form the intial segment in each type of track – please see here for an example of what I mean), and later I’ll do the same with Watford Junction to Rugby, too. I had already manually created a full range of suitable UK style track objects incorporating cant, as well as objects to be used in transition curves, however these objects had one rail lowered and the other raised in height, to suit the cant model used in older versions of openBVE (therefore enabling the wheels to be visibly touching the rails at all times in earlier versions). openBVE v22.214.171.124 features an improved superelevation model however, where one rail is raised above the other (which remains at the same level), so the existing objects were no longer so suitable.
I had started to make some progress in manually modifying my existing objects, however Object Bender has now saved me many days of work, possibly weeks, thereby preserving my sanity and enabling me to easily generate a much more comprehensive range of superelevated track and transition curve objects to create some very nice results, even better than what I’ve shown in Watford Junction to Rugby for a long time now. The slight downside is that the generated objects have a larger filesize compared to the objects I’d entirely hand-written, however Object Bender’s command line arguments also let me automate and recreate many hundreds of track objects, from a handful of source objects, with great ease via shell scripts. This benefit is simply too good to pass up – if I decide that I want to improve or alter my depiction of track in future, all I have to do is edit the handful of template objects and I can recreate the entire library of track objects with just a double-click. An example batch file for Windows users, based on the one which I’ve written for myself, can be found below, along with a sample shell script for Linux users too.
Here’s a selection of screenshots to demonstrate what nice results can be gained quickly, thanks to Object Bender and a little object building skill:
Birmingham Cross-City South v2.0 with superelevated track and transition curves, created via
odakyufan’s Object Bender tool. Also note the embankment (dike) with curved cable trough
in the last screenshot, with the vegetation handled via Object Bender’s /a command-line
argument (please see the Object Bender documention for a tutorial).
One problem I have encountered during the latest Cross-City South superlevated track upgrade so far, is how to accomodate pointwork (switches) on superelevated curves. There are examples of this at Longbridge, between Northfield and Kings Norton, and just after Kings Norton, too. On Watford Junction to Rugby, I took the easy option and handled such situations by transitioning back to uncanted track on either side of points (only with the visual representation of the track – the cant applied via the .Curve command remained constant throughout the points). With Cross-City South v2.0, I’ve decided to gradually alter the height of the other tracks leading towards and away from crossovers connecting superelevated tracks instead, while also rotating the point objects around the Z-axis. This way, the crossover itself is superelevated to the same degree as the tracks being crossed between, which looks better visually, and I presume it’s also more prototypically accurate. Here’s an example between Northfield and Kings Norton, with some new custom pointwork objects I’ve been working on for this location (amongst others):
Birmingham Cross-City South v2.0 with superelevated track and custom-built crossovers.
Note the clamp-lock point machines, too.
Object Bender has most definitely made route building easier and more enjoyable for me, however one problem which needed to be solved, was that when a track object is superelevated, the terminating height of the ballast shoulders on either side of the sleepers is also altered. In a route, and depending upon the design of the track objects, this can lead to gaps appearing between tracks running side-by-side, and between the ballast portion of the track objects and dikes (i.e. the embankment beneath the track):
Depending on the design of track objects, gaps can appear
between the ballast shoulder and dike, or a parallel track,
when superelevation is applied via Object Bender.
I’ve solved this problem, by expanding the ballast shoulder in the track object to include two faces at increasing angles, such that at the maximum level of visible cant I’ll ever apply in my routes (160mm in my case), no gaps appear and the cable trough isn’t obscured, while I can continue to use only one template object for creating the full range of curved track pieces, at differing degrees of superelevation, via Object Bender. The ballast portions of the dike objects are also extended. This solution does lead to more faces being rendered, but hopefully it’s not too much of an issue, performance wise. Here’s a screenshot:
Extended ballast shoulders in both the track and dike objects,
to remove visible gaps when cant is applied via Object Bender.
Object Bender supports some markup which can be applied to template objects before they’re processed, for example, to determine the desired texture coordinate shifting in generated segments (please see the Object Bender documention on the openBVE homepage for more information – I think the tutorial is clear enough that I don’t need to explain it further). I was originally going to suggest expanding the supported markup a little, so that Object Bender could be instructed to leave the X and/or Y coordinates of any vertex as it is in the original template object, which would for example, solve the ballast shoulder issue above in an easier way for the object creator. However, I quite like the appearance of the solution I came up with, so I don’t think such a change to Object Bender is too important, but might be nice to have, nevertheless.
Lastly, for more advanced users, or beginners feeling more adventurous, here’s a sample batch file for Windows users, and a bash script for Linux users, which you can adapt and expand if you want to automatically create a range of curved objects using Object Bender’s command line interface, rather than the GUI. There is a simple example of a suitable batch file included in the Object Bender documention, however rather more can be done with batch files/shell scripts. These following example scripts use variables to reduce the amount of duplicated text that you might otherwise need to type, and they also create a logfile which you can read, which is handy if you’re generating a large number of objects, to more easily check for any errors which might have occured during a lengthy object bending batch process.
For the Windows batch file, you need to give it a .bat extension. The text highlighted in red (including the less/greater than characters), should be replaced by any paths or filenames which are appropriate for your purposes. Where <Your_File_To_Append> is concerned, this object file could contain fishplates for example, or overhead wires, which are appended to the object generated in the previous line (please see here for more information). You can see fishplates added to my curved wooden sleeper based track objects in the above Cross-City South v2.0 screenshots – this is how they were appended to the files generated via Object Bender.
rem Set variables (paths and extension for all files)
rem Clear the screen and ask user for confirmation
echo Proceed with object creation? This will overwrite any existing files.
echo Press Ctrl+C to cancel, or any other key to proceed . . .
pause > nul
echo Processing files and creating log. Please wait . . .
rem Create a new log file with time stamp
echo ___________________________________ > %objectbender_path%objectbender_log.txt
echo New log [%date% at %time%] >> %objectbender_path%objectbender_log.txt
echo. >> %objectbender_path%objectbender_log.txt
rem Use Object Bender to create finished objects from templates
rem 500m right curve
%objectbender_path%%exe% %obj_source%<Your_Source_File> %obj_final%<Your_500m_Right_Track_Object> /n=5 /s=5 /b=25 /r=500 /g=1435 /u=80 /v=80 >> %objectbender_path%objectbender_log.txt
%objectbender_path%%exe% %obj_source%<Your_File_To_Append> %obj_final%<Your_500m_Right_Track_Object> /a /n=1 /s=25 /b=25 /r=500 /g=1435 /u=80 /v=80 >> %objectbender_path%objectbender_log.txt
rem 600m right curve
%objectbender_path%%exe% %obj_source%<Your_Source_File> %obj_final%<Your_600m_Right_Track_Object> /n=5 /s=5 /b=25 /r=600 /g=1435 /u=80 /v=80 >> %objectbender_path%objectbender_log.txt
%objectbender_path%%exe% %obj_source%<Your_File_To_Append> %obj_final%<Your_600m_Right_Track_Object> /a /n=1 /s=25 /b=25 /r=600 /g=1435 /u=80 /v=80 >> %objectbender_path%objectbender_log.txt
rem 700m right curve, etc. . .
Linux users can adapt the following shell script to make use of Object Bender for automating the creation of multiple files. Your script should be given a .sh file extension, and be made executable (for example: chmod +x myscript.sh). The script can be executed from the Terminal prompt by typing, for example: ./myscript.sh). Don’t forget that Object Bender requires Mono to be installed, too.
# Set variables (paths and extension for all files)
# Clear the screen and ask user for confirmation
echo "Proceed with object creation? This will overwrite any existing files."
read -s -n 1 -p "Press Ctrl+C to cancel, or any other key to continue . . ."
echo "Processing files and creating log. Please wait . . ."
# Create a new log file with time stamp
echo _____________________________________ > $objectbender_path/objectbender_log
echo New log [$(date)] >> $objectbender_path/objectbender_log
echo >> $objectbender_path/objectbender_log
# Use Object Bender to create finished objects from templates
# 500m right curve
mono $objectbender_path/$exe $obj_source/<Your_Source_File> $obj_final/<Your_500m_Right_Track_Object> -n=5 -s=5 -b=25 -r=500 -g=1435 -u=80 -v=80 >> $objectbender_path/objectbender_log
mono $objectbender_path/$exe $obj_source/<Your_File_To_Append> $obj_final/<Your_500m_Right_Track_Object> -a -n=1 -s=25 -b=25 -r=500 -g=1435 -u=80 -v=80 >> $objectbender_path/objectbender_log
# 600m right curve
mono $objectbender_path/$exe $obj_source/<Your_Source_File> $obj_final/<Your_600m_Right_Track_Object> -n=5 -s=5 -b=25 -r=600 -g=1435 -u=80 -v=80 >> $objectbender_path/objectbender_log
mono $objectbender_path/$exe $obj_source/<Your_File_To_Append> $obj_final/<Your_600m_Right_Track_Object> -a -n=1 -s=25 -b=25 -r=600 -g=1435 -u=80 -v=80 >> $objectbender_path/objectbender_log
# 700m right curve, etc. . .
If you need any help with using Object Bender or writing scripts to automate curved object creation, please feel free to ask. 🙂
This entry was posted by Anthony Bowden on Sunday, September 5th, 2010 at 7:30 am and is filed under openBVE. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
Leave a Reply