Scenery Tools
Virtual Sailor comes with several utility tools for assisting model and scenery making.
These tools can be found inside the tools directory of the program, you can also download the tools here.
The following section explains the available tools for Virtual Sailor and their use.
Virtual Sailor 2.0 already containes some of these tool inside the program itself, scenery importing is done automatically and also aerial navigation aids are imported automatically by the program for each new scenery detected.
The Model Encoder
The model encoder utility model_encoder.exe converts DirectX mesh files ( .x ) to encoded files read by the program ( .xx ),
This tool allows authors to protect their work against unauthorized use by others or for different purposes.
The x file format is an public format it can be converted and re used, the xx file is encoded by the model encoder and decoded by Virtual Sailor, it is read whenever an .x file is expected, so you can simply replace the .x file with the encoded .xx file.
Encoded models are read for all models used by the program, for scenery and vehicles as well.
Using the model_encoder:
- Run it from the tools directory of the program
- Press “Open Directory” and browse to the directory where the models are stored.
- Press “Encode Files”, the files are encoded in place, you will see these files with prefix of .xx.
- You can now remove the original .x files and the encoded files will be used by the program.
The matrix resize
The matrix resize matrix_resize.exe resizes a binary matrix to a size of your choice, this tool is particularly useful for resizing matrix which is too large or too small to fit into the resolution or disk size you want.
The result of this resize is a change of the digital elevation resolution, for example if you have a huge terrain matrix with resolution of 10 meter per elevation point you can resize the matrix by a factor of three, this will result in a matrix file with almost one tenth the size and an excellent resolution of 30 meters per elevation point.
You can also use this tool to resize a matrix with an odd scale that doesn’t fit your scenery or matrix editor well, and make it smaller and more rectangular in shape.
The tool reads the terrain matrix and the header file and outputs the files out.bin and out.hdr in the same directory.
Using the matrix resize:
- Run the matrix resize from the tools directory of the program.
- Press “Load Matrix” and select the terrain matrix of your choice.
- Once the matrix is loaded the width and height will appear on the top row.
- Type the setting of your choice on the bottom row and press “Save Matrix”.
- Check the directory you loaded the matrix from and find the output files.
- Move the original files to another location and run Virtual Sailor.
- The new files are used instead of the original.
The matrix editor
The matrix editor matrix_editor.exe is used to open and edit a binary terrain matrix, this tool can be used to create artificial places, smooth noise elevation data, flatten areas before creating runways upon them, coastline correction and more.
This tool opens binary terrain matrix and header file and edits them in place, it can also compress the matrix and prepare it for the matrix unpack utility typically used to uncompress and install large scenery files.
Using the matrix editor:
These are the bottons and functions from to left to bottom right:
- Load Matrix, loads the elevation matrix from pair of files ( matrix.bin and matrix.hdr )
- Save Matrix, saves the matrix you have edited using this program back into the matrix.bin file.
- Zoom in, zooms in to cursor, default zoom is 1.
- Zoom out, zooms out of cursor, default zoom is 1/
- East, North, the coordinates at cursor in degress.decimal.
- Selection radio buttons, set the action you are making when clicking or clicking and dragging the mouse upon the map, these include:
- Pan – click and drag to move the map on screen.
- Change – click or click and drag to change the value for the pixel and its neighbours, to control the area of change use the brush radius, brush opacity determines the mixing strength of the value you set in the elevation box and the existing value of pixels.
- Smooth – smooths the value of the pixel with its neighbours, to change the area of smoothing select brush size, minimal size accpetable is 0.
- Add – adds the value of elevation to the pixel and its neighbours, value can be positive or negative.
- Subtract – subtracts the value of elevation to the pixel and its neighbours, value can be positive or negative.
- Combined map, this is a display showing depth and elevation, like the image you see below, this mode also allows you to edit all values, positive and negative, adding and subtracting freely.
- Depth map, this mode shows only the depth map, and edits only negative values clamping changes to negative values only.
- Land map, clearing the combined and depth selection leaves land map mode, this mode allows editing of positiove values and clamps the values to positive.
- Update palette, this button uses the max altitude and min altitude values, and constructs land palette, and depth palette, the combined map shows the positive and negative elevations of both these palettes, land palelle is created from the values between 0 and max altitude, depth palette is constructed for the values between 0 and min altitude.
- Create depths, this function creates depth map for all values below zero, so that sea bottom is at the Bottom depth value, and a thin line just off the coast is kept at Shelf depth.
- Smooth, this function smooths depths so that the transition between shelf depth and bottom depth is more gradual resulting in shallower beaches, the operation of create depths and smooth may be repeated over and over until the desired result is reached.
- Add bias, this function adds Land Bias value to positive values, and Depth bias to negative values, enhacing the contrast for shallow coastlines and mariginal land and sea boundary.
- Add all, this function adds Land Bias value to all depths positive and negative, allowing better identification of coastlines for maps of SRTM4 and other sources, where the rives and coastlines are very shallow.
- Save depth, this function saves the depths values as depth.jpg image, allowing external editor to edit this depth map.
- Load depth, this function loads the depth.jpg image back into depths values, you can use external image editor to create your own depths and load them back.
- Save land, this function saves the land values as land.jpg image, allowing external editor to edit this land map.
- Load land, this function loads the land.jpg image back into land values, you can use external image editor to create your own elevations and load them back.
- To compress the matrix press “Compress” and select the matrix from the file you saved, this saves a jpg and an rle file pair.
- To uncompress a compressed file press uncompress and select the RLE file of the compressed pair, the binary matrix file is restored.
Matrix Compression:
Binary matrix files can be very large, this makes add-on size very big and download times very long, ordinary compression methods do not handle binary matrix files well because the elevation data is arranged two bytes, this means that the fine changes are recorded in the low byte of each two byte pair of the matrix elevation file, and large changes are recorded in the high byte of each pair.
To solve this problem, the matrix compression method in the matrix editor splits the information into two chunks of data, the rough data and the fine data, ( the rough is elevation divided by 256 , the fine if the remainder of this division ).
Then the fine data is compressed by ordinary jpeg compression, and the rough data is RLE ( run length encoding ) compressed, this provide for a lossless compression for the rough data and slightly lossy compression for the fine.
The compressed matrix is split into two files, a jpg file and an rle file, these two files should be shipped together with the header file of the matrix to allow it to restore properly.
To uncompress these files into the original binary matrix file you must have the three files together, the jpg, rle and hdr, then use the matrix editor, or use the matrix unpack utility that comes with the program as well.
The matrix unpack
The matrix unpack matrix_unpack.exe is used to unpack any compressed matrix found in the program, it is used by the program installation itself after install, and can be used after installing every add-on scenery.
Using the matrix unpack:
- Run the matrix unpack from the tools directory of the program.
- Let it search and uncompress any compressed matrix it finds in any of the sceneries installed.
- If you are making add-on scenery, compress the matrix file and include the compressed files ( jpg + rle + hdr ) inside your scenery instead of the large binary matrix file, then create an installed for your scenery and make it run this tool after installation.
The X Files Converter
Virtual Sailor uses the DirectX format for 3D model files, typically these files are generated by 3D modeling software and saved in the very popular 3DS format, from this format they can be converted to DirectX files using a converter created by Microsoft called Conv3ds.
Conv3ds can be downloaded on this link:
To use conv3ds you need to run a command shell on the directory containing the model file and the converter, use the command conv3ds followed by the name of your file, for example “conv3ds glider.3ds” and a file called glider.x will be created.
To start a command shell, press on your computer Start -> Run and then type cmd, a command shell will open, change the directory using DOS commands like, “cd \work” etc.., a typical command shell looks like this:
Converting from other software
Some modeling software have their own X Files exporters, for example if you are using the excellent 3D Studio Max you can use the Panda Exporter plug-in, to download the panda exporter use this link.
Download here Pandasoft or here Panda Exporter for 3D Studio 9
The KML Importer
The KML importer kml_import.exe is used to import roads, objects and polygons made using Google Earth into Virtual Sailor, this tool provides easy and standard way of designing roads, objects and areas for Virtual Sailor, it is recommended to use this tool instead of the scenery designer, as this tool can be used to convert files you can edit using Google earth.
This tool is for advanced users only, it is recommended to use the program internal scenery editor to visually place objects and roads, this tool helps if you wish to place objects using google earth, the abs_objects.txt created by it requires additional work using the program scenery design mode, but gives you the match between google eath coordinates and scenery positions inside the program.
This tool opens and converts KML files exported from google earth, and saves them into a file called abs_objects.txt, this file can be edited by hand and added to the scenery objects using the command “add absolute file”.
Using the KML importer:
- Open Google Earth and view the area of your choice.
- Add folder under “My Places” in Google earth..
- Add Path, Place mark or polygon under this folder.
- Name each object you make as you would name it in the objects.txt ( road_a.bmp, buildrw1.x, etc.. ).
- Select “Save place as” on the folder you created and save it as KML file inside your scenery.
- Run the KML importer and select this KML file.
- A file called “abs_objects.txt” is created and you see a map of the objects you have made.
- Examine the file created and adjust names, scales and angles of the objects listed there.
- Start Virtual Sailor and select objects design, then load the absolute file you created.
Google earth provides easy way to lay your objects and roads in place.
The exported objects appear as a map inside the KML exporter.
The NAV Importer
The NAV importer nav_import.exe is used to create a navigation aids file navaids.txt for your scenery.
This tool is for your reference only, by default the program imports navigation aids when “navaids.txt” file is not found inside the scenery.
This tool uses a data file called earth_nav.dat which contains the list of known navigation aids for the whole world, to use this tool you must enter the coordinates of your scenery and then select this file and load it, the result is saved into the tools directory into a file called navaids.txt, you must take this file and move it inside the scenery you are making in order for it to be used as navigation aids file.
Using the NAV importer:
- Run the nav_importer.exe from the tools directory.
- Enter the extents of the scenery you are making in the form min max longitude and latitude.
- Press Import File and select the file called earth_nav.dat.
- Take the file called naviads.txt created inside the tools directory and move it inside the scenery you are making.
The Virtual Sailor Scripting Language (VSSL)
The Virtual Sailor Scripting Language is a simple yet high level scripting language allowing complicated missions and scenarios to be created for Virtual Sailor, a full description of the scripting language is available here, this scripting language was added since version 1.6.
The VSSL documentation
Some samples are available inside the scripts directory inside the program, some demo situations are also available as part of version 1.6.