Jump to content

Export a Spline from Giants Editor into Blender to Create Roads/Railways (Updated)


Recommended Posts

  • Wrinkley


An updated version of the Spline CSV Creator Panels script is available here


This new version creates a spline.obj file from the newly created spline for direct import into Blender without the need to convert from a .csv file

This spline.obj will still need converting to a curve in Blender to create roads etc.


There are two parts to this tutorial, the first part deals with creating a 2D spline in Giants Editor and using the

Spline CSV  Creator scripts to create a new spline aligned to the terrain with more cv's at a chosen set distance along it.

Also created is a CSV (Comma Separated Variable  ) file for use in Blender 2.79 (Only)  to create a road mesh .i3d aligned to the map terrain.

The following scripts are also used in this tutorial.

Spline CSV  Creator Set Up

Terrain Paint Set Up,

Terrain Paint

 Terrain Height Set Up

Terrain Height

The second part, the Blender section deals with creating a new mesh from the CSV data and using it to create a road layout i3d aligned to the terrain of your map for import into Giants Editor.

Note:  There is now an add on that imports the csv file directly into Blender  see  https://farmerboysmodding.com/index.php?/topic/2438-blender-plugin-300-and-above-for-splinecsv-data/

Whilst at first the tutorial may seem a little complicated once run through a couple of times it will seem quite easy.


All the scripts used in this tutorial, together  with the installation instructions are available here.

24/05/23   ---   Link to newer versions of the scripts  -- these versions do not require the separate setUp scripts



Link to original updated scripts





Spline CSV  Creator Set Up

Creates in the Giants Editor User Attributes panel the required User Attributes for the Spline CSV Creator


The script is executed simply by Selecting –Scripts -- Spline CSV  Creator Set Up in GE --and must be initiated before executing the Spline CSV  Creator script.

Spline CSV Creator

Creates a new Spline_CSV.i3d from an existing spline aligned to the terrain with the CSV distance set by the

CSV Distance attribute in the User Attributes panel,  also created is a Spline_ CSV data .txt both are placed in the

new  CSVdata  folder created In the root folder of your map.

The CSV data is automatically converted from the Giants Editor transform axis to the Blender format, X(Z) axis, Y(X) axis,  Z(Y) axis, (Giants in brackets) to use with the csv Importer script in Blender 2.79

The script allows for the original spline to be created in 2D with less cv’s and away from the terrain, the new spline created can easily be used in any of the Spline Height/Paint/ Placement  scripts.

Create a spline and align it to the road/rail network you wish to model, naming it accordingly.

The spline can be called any name as long as it has the word spline in it i.e. road01_spline,  spline_2 etc,

the name chosen will also be the name of the spline.i3d and spline_CSVdata.txt  created in the CSVdata folder in your map root folder.




In Giants Editor --Select  Scripts—Spline CSV Creator  Set Up which will then create the User Attributes required by the Spline CSV Creator script  a ‘ ‘SplineNameCSV Creator Attributes Created ‘ message will appear in the consol log,  then,




Insert your map name in the (b).Map Name attribute   

The full name of your map ( root folder name) must be entered (Case Sensitive) in the (b). Map Name attribute in order for the CSVdata folder to be place in the correct position (map Root Folder)

Insert the required value to the (c).CSV Distance attribute.

The lower the number the more cv’s and greater accuracy in alignment in Blender or when used with the Spline Placement script

In the example image below its set to 5, generally  a value of 5 for roads and 10 or more for train tracks (gives a smoother incline) should be sufficient, but bear in mind that this distance will be the size of your individual road/rail sections in Blender.




With the spline selected Select –Scripts --Spline CSV Creator

A new Spline.i3d  with your chosen Spline name will be placed in a newly created CSVdata folder in the map root folder along with a Spline_CSVdata.txt file.

The message ‘New Spline: road01_spline_CSV.i3d and  road01_CSVdata.txt created in Manor Farm / CSVdata Folder’ will also appear in the consol log, in this example the spline has been named road01_spline and map name is ‘Manor Farm.

The new road01_spline.i3d can be imported directly into the map in GE by selecting File-Import and navigating to the map CSVdata folder in the map root folder and selecting the road01_spline_CSV.i3d which will then appear at the correct location in your map.

The road01_CSVdata .txt  is for use with the csv_importer script in Blender 2.79(only at the moment) and can be referenced in Blender directly from the CSVdata folder.




The following image shows the Attributes and log messages created when selecting --

Spline CSV Creator  Set Up                                                                                   Spline CSV Creator


finally showing the imported road01_spline_CSV, note that the imported road01_spline_CSV translation is now set at 0,0,0 not at the road01_spline settings


Setting Up the map


Navigate to the CSVdata  folder (in your map Root folder) and import the new --your name spline_CSV.i3d

The next step is to paint the terrain along the road01_spline_CSV spline.

Whilst this is not strictly necessary there are two reasons to do it, the first is to paint the terrain under any road mesh with a high AI value texture such as Asphalt or Gravel, although this probably won’t be seen, it means that an AI spline need not be created along any road mesh route not covered by the main traffic or AI splines, the second is purely for indication of road and edge size when setting the terrain height along this spline (settings should roughly reference to final Blender road width).

It can also gives a performance advantage by allowing a lower clip distance on the road mesh without any visual loss when viewed from a distance.


First  Select—Scripts -- Terrain Paint Set Up  this will create the User Attributes necessary for the Terrain Paint script and also print out the terrain layers textures in the Console log.

In this example the Attributes have been sets as

Set Centre Texture Width           5m 

Set Edge Texture Width               3m (both edges)

Set Edge Texture Left                    102  --see print out in Console Log for GRASS

Set TextureCentre                          98 --see print out in Console Log for ASPHALT

Set Edge Texture Right                  102  --see print out in Console Log for GRASS

Set Distance Between Textures  0.5 --textures painted every 0.5m

Select—Scripts-- Terrain Paint and the terrain will be painted with the chosen textures the following entry is printed out in the Console log detailing the settings.

Spline Name : road01_spline _CSV

Texture Left :- 93 -- GRASS

Texture Centre :- 89 -- ASPHALT

Texture Right :- 93 -- GRASS

Centre Width : 5.0 m : Edge Width : 3.0 m :

Texture Distance: 0.5

Result shown in following image.



To ensure any new road mesh created using this CSV spline as a base fits the terrain it is necessary to provisionally adjust the terrain height along the length of the spline using the Terrain Height scripts. Terrain height may need to be adjusted when road mesh finally completed due to relaxing/smoothing of csv mesh.

Before executing the Terrain  Height script ensure that you save the map and make a backup copy of your map_dem.png in case of any problems.



Select  Scripts - Terrain Height Set Up 

This will create the necessary User Attributes used by the Terrain Height script.

In the image above, the inset shows the original terrain profile with a sharp drop on the right hand side and raised terrain on the left hand side so the settings below have taken this into account this allows easier blending of either edge with GE terrain tools once the Terrain Height script has been executed.

Also note that the Terrain Paint User Attributes are also shown the  User Attributes window this is because the map was saved before the Terrain Height Set Up script was executed so the Terrain Paint User attributes were saved in the normal way and can still be used to adjust terrain textures  using this road01_spline _CSV spline.

User Attribute values,

Set CentreWidth     6  (m)             -- size dependant on final mesh size in Blender in this case a 6m roadbed with 2m

    Edges  giving a 1m adjustment for final blending in GE after placement.

Set SplineHeight      0  (m)            --spline aligned to terrain

Edge Transformation                      ‘selected’  --allows independent height and smoothing to either edge

Set EdgeWidth          3 (m)             3m edge width either side of the CentreWidth

Set Edge Height Left                       4 (m)   raises the left hand edge by 4m to match left hand terrain.

Set Edge Height Right                    -4 (m)   lowers right hand edge by-4m to match right hand terrain

Set Edge Smooth Left    10            factors the amount of smoothing on the left hand edge

Set Edge Smooth Right  10           factors the amount of smoothing on the right hand edge

Select Scripts—Terrain Height

The effects of these values are shown in the main window of the image above also printed in the Console log is a reference detailing the settings used together with the name of the spline, in this case

Spline Name : road01_spline _CSV


Spline Height: 0.0

Centre Width: 7.0 m :Edge Width: 4.0 m :

Height Left: 4 :Height Right: -4 :

Smoothing Left: 8 Smoothing Right:8 

Shown bottom right in the above image

 Further smoothing of the edge area can be made by reducing the EdgeWidth , HeightLeft and HeightRight by 1 and re executing the script until the EdgeWidth is ‘0’ (CentreWidth value not changed during this operation)

Also note that the Terrain Paint User Attributes are also shown the  User Attributes window this is because the map was saved before the Terrain Height Set Up script was executed .


Once executed this terrain deformation cannot normally be undone, but provided you haven’t saved the map after executing the script the terrain can be reset back to previous levels by selecting the Reload i3d  in the toolbar( under the Create tab) then re adjusting script values as required.

If the map has been saved then the only way of redoing the terrain is to Copy/Paste your backup map_dem.png into the map data folder.

Once happy with the results save the map.


NOTE: Before  continuing see note at the beginning of the tutorial regarding update Spline CSV Panel script which now creates a spline.obj for direct import into BLender


BLENDER 3.0.0 and above


I have created a new plugin for Blender 3.0.0 and above which allows the  SplineCSV data created in the Spline CSV Creator script to be directly imported into Blender instead of having to use an earlier version of Blender and exporting/importing as an obj which was previously necessary.



Download the spline_csv_importer.zip file available at the bottom of this topic.

Open Blender (3.0.0 and above)

Select –Edit—Preferences –Install and in the file browser navigate to where you saved the spline_csv_importer.zip file, Select and Install the Add-on.

Once installed Activate it by selecting the check box (a single Left click usually brings up the Activation and Information panel)

The Add-on can also be found in the Blender Preferences panel under Import-Export: Spline CSV Importer.

Spline_CSV Importer


Open Blender,

Select File –Import – Import_Spline Data (*txt) a File Browser Panel will pop up. ( an undocumented operator panel appear but this can be ignored it just means I haven’t documented it with Blender)

Navigate to where the CSVdata folder is (your map root folder), double click to open the folder and select the relevant spline_CSVdata.txt file, once selected,  select the IMPORT CSV tab in the file browser.

A new Collection in the Scene Collection Panel , SplineCSV will have been created and into that the new spline_CSVdata mesh (keeping your original name) will have been placed and the new spline_CSVdata mesh will also have been created in the same position in Blender as it was in your map ready for you to work with, the image below is for reference.



All subsequent imports of Spline CSV data will be appended to the SplineCSV Collection retaining their original names


This Add-on will only create an single edge mesh (no other type of mesh) from a txt file created in the same format as the spline_CSVdata.txt file (i.e. no header), coordinates in the spline_CSVdata.tx have already been converted to the Blender format in the CSV Creator script and can be exported as an i3d or Nurbs curves directly back into Giants Editor.



Blender 3.2 and above  (other versions may differ in Menu’s and settings)


 Do NOT change the location of your mesh,  if it is changed then problems will occur in placement when exporting final road mesh.

(Quick way of getting the mesh in view is with the mesh selected, in the Collections panel, select decimal point on the Keypad)

In Edit Mode ,with the mesh selected open the Tools Panel ‘N’ and select Edit – Loop Tools – Relax (arrow to left of word Relax)

In the dropdown


Iterations ‘ 1 ‘       Note: High values will result in straightening out of curves  

Regular Selected

And select Relax

This will relax the mesh giving a smoother line along the whole mesh.

Change to Object Mode, with the mesh selected –Select , Object—Convert—Curve , this converts the mesh to a curve ready for use with the Curve Tools.

Select the Curve Icon in the Scene panel (green semi circle) to open the Curve Tools Panel


With the curve still selected change to Edit Mode

The new curve first needs to be aligned along the correct axis for the road, to do this you can either select

Control Points—Tilt and type 90 or simply (Ctrl ) -- T -- 90

In the Shape panel of the Curve Tools, select 3D, Fill Mode 'Half',  Curve Deform 'Radius Selected', all other settings can be left as is.

Open the Geometry and Bevel Tabs

Geometry Tab

 Extrude  ‘ 3 ‘        ---this equates to a road bed width of 6 metres , half the desired width

Offset  ‘ 0 ‘            ---value can be left at 0 as this just raises or lowers the mesh by +-1m

Bevel Tab

Select   -- Profile

Depth   ‘ 2             -- this figure is the width of the road edges in metres, in this case 2 for 2m

Resoloution – ‘ 0 ’ --This figure sets the number of subdivisions in the edge mesh should you wish to create

         your  own custom or preset profile.



You will note that after entering the figure in the Depth box the curve point of origin  is now aligned to the bottom of the edges, this change will need to be catered for when the mesh is finally imported into GE.

The following image shows the result of these transformations.



Once you are happy with the basic shape, the curve deformations can now be turned into an editable mesh.

With the curve selected

Object Mode – Object –Convert --- Mesh

The mesh can now be edited in the normal way for example adjusting the bends in the road to be smoother and adding white lines (see Enhancements at the end of the tutorial).



Add the texture you are going to use in the normal way

One quick method I use is in the example below,

Edit mode     –with all the road bed faces selected

UV –Reset     -- adjust the UV map to fit the road bed texture (inset 1 shows full road texture )

Do the same for each of the road edges then,

Edit Mode—Edge Select – and select both outside road edges and raise to a shallower angle (inset 2)



Finally Export as an i3d either using the .blend filename or creating your own in File Location



Open your map in GE and import the road mesh i3d (in this case it is road01_splineCSV)

Rotate the ‘Y’ axis by -90 and adjust the ‘Y’ Translation of the road mesh to match the  flattened terrain.

Further adjustments (texturing/terrain height) of the road area can now be carried out.

The image below shows the road imported and adjusted, the inset shows a magnified image of the road placement at the indicated location.



Note: To enable the AI to work better with the new road mesh, the Collision Mask (Hex) should be set up as follows,



0: "DEFAULT: The default bit",
1: "STATIC_WORLD: Collision with terrain, terrainHeight and static objects",
2: "STATIC_WORLD_WITHOUT_DELTA: Deprecated in FS22: Do not use it anymore!",
3: "STATIC_OBJECTS: Collision with static objects",
4: "STATIC_OBJECT: A static object",
Deselected is 5: "AI_BLOCKING: Blocks the AI",
6: "TRACTOR: Deprecated in FS22: Do not use it anymore!",
7: "COMBINE: Deprecated in FS22: Do not use it anymore!",
18: "AI_DRIVABLE: AI can drive over this node",


The above settings are taken from the base game road mesh , although numbers 2,6, and 7 state that they are no longer used it would be prudent to include them anyway as the collision masks may have changed in later game patches.




Adjusting and smoothing blocky curves/bends

Example; Navigate to a curve section you want to adjust in the viewport

Edit Mode

Select the outer edges of the road sections in the bend (3 in this case) and subdivide, number of subdivisions will be dependent on smoothness required.

Open the Tools Panel ‘N’ and select Edit – Loop Tools – Relax (arrow to left of word Relax)

In the dropdown

InterpolationLinear- Projects vertices on straight line, Cubic uses a natural cubic spline to project the vertices

Input Parallel (all) --This will also modify any parallel vertices at the same time, if in doubt select,  Section, only

          selected modified.

Iterations ‘ 1 ‘          – No of times tool is run, higher number gives smoother results but straightens out the curve

Regular Selected –When selected vertices spread evenly along the loop

Select the vertices along the edge of the curve Section, and select Relax

Further smoothing can be carried out by repeating the above process on the relevant section

Finally select all the vertices along one edge of the whole road mesh and then select Relax

This will smooth out the whole road mesh


Image below shows the various stages and images 1 and 3 show the before and after result.



Adding Custom road markings.


Select all the road bed faces (Shift-Alt held - select face) of your finished road mesh, change to Edge select, again with Shift-Alt held deselect left and right hand edges and Subdivide ' 1 '.

Select the new centre edge (Shift-Alt held - select edge) and Shift-D to copy ' P ' Selection to separate from main road mesh, with the new edge mesh selected

Object mode


Curve Tools panel --Shape-- Geometry and set Extrude to ‘ 0.2 ‘ (Extrude value dependent on the width of the road marking texture used)

Edit mode Ctrl 'T ' -90 to correct the axis.

Object mode -- Object--Convert--Mesh

Add texture as normal not forgetting alpha channel settings in Blender

Edit mode -Face select --select all

UV—Reset   -- adjust UV mesh to fit texture

Texture may need to be adjust on the bends but that is easily done in the UV editing window

Finally when satisfied export as i3d.

To do the edge markings (if required), select the left hand or right hand edge and Shift-D to copy ' P ' Selection to separate from main road mesh and continue as above, doing the same for the other edge.

Example below



The previous tutorial showed two ways of creating the road mesh from the CSV mesh but I think the above  method is the quickest and easiest way to get the best results.


As it is possible to  create a spline in Blender 3.2 and export it as an i3d you can create a set of splines aligned to the road mesh to use in  the Spline Placement script and also for traffic/railway splines

Using the finished road mesh as an example

For Spline Placement

In Edit mode, Edge Select

Shift-Alt select the left or right hand road edge so all the edges are selected.

Shift ‘ D ‘ to copy

With the edge still selected ‘ P ‘ Selection to separate

Object Mode

With the edge selected -- Object –Convert—Curve

Edit Mode

Curve –Set Spline Type – NURBS

Object mode

Open i3d exporter Export Tab and ensure that Nurbs Curves and Shapes are selected

Set up filename and File Location in the Output tab

Export the i3d

Import into map set ‘ Y ‘ rotation to -90 and Edit-- Freeze Transformation –Rotate Only (leave preserve instances selected) height settings do not matter as objects will be placed on the terrain at their point of origin.

Replace any splines in the splinePlacement transform with this new spline and set up the script parameters accordingly.

Example before selecting Object mode and exporting



For traffic/railway splines


Select all the road bed faces (Shift-Alt held - select face) of your finished road mesh, change to Edge select, again with Shift-Alt held deselect left and right hand edges and Subdivide '3 '. If creating a railroad spline then Subdivide ' 1 '

Subdivide ‘ 3’ is necessary to get the correct location for the traffic splines (midway between centre and edge).

The centre edge line can be used, if required, as a new roadSpline01_CSV to adjust any terrain height after smoothing of road mesh (slight straightening of bends etc).



Shift-Alt select edge to the left of the centre of the road mesh so all the edges are selected and continue as above for the splineUtilsPlace adding a further step after the ‘With the edge still selected ‘ P ‘ Selection to separate’ of renaming the mesh to traffic01_left for clarity and continue the method above.

Repeat the procedure for the right hand edge.

Image showing both sets of splines.



Once the traffic splines are imported the Translation/Rotation needs to be set up as follows

Translate ‘ X ‘ and ‘ Z ‘ to‘ 0 ‘

Translate ‘Y ‘  to  a suitable value to align it just above the road mesh, in this case -1.9

Rotate ‘ X ‘ and  ‘ Z ‘ to ‘ 0 ‘

Rotate ‘Y ‘  to  -90

Once done freeze (Edit-Freeze Transformation) the Transformation/Rotation settings.

As both traffic splines, after importing are in the same direction, traffic direction can be set by selecting the relevant spline and pressing the ‘ R ‘ key on your keyboard.

All the splines once imported into the map can be edited/ expanded in the normal way.

Note: Regardless of the filename you have given the spline in Blender the name in the scenegraph of GE will be the

name in the Collections Panel of Blender with the suffix.001 in this case road01_splineCSV.001

Below is an example showing the road mesh, markings,  together with the various splines and also objects that have been placed using the Spline Placement script (see Terrain Height, Paint Terrain and Spline Placement scripts (Updated) for details of placement).



  • Like 1
  • Thanks 3
Link to comment
Share on other sites

  • 2 weeks later...
  • 3 months later...
  • Wrinkley

Yes a python script is required to open the csv file in Blender, there is a link to the download in the tutorial for the only version currently available which only works in Blender 2.93


If you have a created a python script that does the same in Blender 3.2 and above  that would be great.

I did look into creating a mesh fom the CSV data in lua  so the spline could be exported as an obj mesh but decided to go with the CSV conversion instead (easy option)




Edited by WrinkleysRule
added further info
Link to comment
Share on other sites

  • 3 weeks later...
  • 2 weeks later...
On 2/22/2023 at 2:13 PM, icolinmeiklem said:

my GE freezes when i do the height terrain part, not sure why, can't see it being my system as i don't have the worse of systems.

I have 64GB of RAM and an I9, and a long road can take a LOOOOOONG time to do the height adjustment, upwards of 10-20 mins in some cases on my 4x map. So give it chance.

Link to comment
Share on other sites

  • 5 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now