Jump to content
Sign in to follow this  

Paint Terrain By Spline- Update

Recommended Posts

Nice little script in the Script Editor of GE 8.1.0 in the Shared -- FS19--Editor Utils section, Paint Terrain By Spline works in much the same way as the Terrain Height Script.
Utilises the numbered position of the relevant texture files in the Layers Section of the TerrainTransformGroup.
To get the relevant number there are a couple of methods, the first is to open the Texture Layer drop down box and see what texture is the first single texture listed, in this case it is mudDark01 this then needs to be noted down as
0 mudDark01 then
1 mudDark02
2 mudDark03  
and so on until you get to the last single texture then continue consecutively numbering the CombinedLayers
i.e last single texture
67 graniteCliff04
The following table shows the list from a starter map other lists may vary depending on the position of the texture files and the numbers involved.

0   mudDark01      24   forestGround01      48   concrete01            68   MUD_DARK
1   mudDark02      25   forestGround02       49   concrete02           69   DIRT_ROUGH
2   mudDark03      26   forestGround03       50   concrete03           70   DIRT_LIGHT
3   mudDark04      27   forestGround04       51   concrete04            71   GRASS
4   dirtRough01     28   forestNeedles01       52   dustyRockUS01   72   GRASS_DRY
5   dirtRough02     29   sand01                      53   dustyRockUS02   73   GRASS_ROUGH
6   dirtRough03      30   sand02                     54   dustyRockUS03   74   FOREST_GROUND
7   dirtRough04      31   sand03                     55   dustyRockUS04   75   ASPHALT
8   dirtLight01        32   sand04                    56   cliffRock01          76   CONCRETE
9   dirtLight02        33   sandWet01              57   cliffRock02          77   GRAVEL
10   dirtLight03       34   sandWet02              58   cliffRock03          78   SAND
11   dirtLight04       35   sandWet03             59   cliffRock04          79   SAND_ROUGH
12   grass01             36   sandWet04             60   gravel01                80   SAND_WET
13   grass02             37   sandRough01         61   gravel02                81   DUSTY_ROCK
14   grass03             38   sandRough02         62   gravel03                82   CLIFF_RED_ROCK
15   grass04             39   sandRough03        63   gravel04                83   GRANITE_ROCK
16   grassRough01   40   sandRough04        64   graniteCliff01      
17   grassRough02   41   sandPuddleUS01   65   graniteCliff02      
18   grassRough03   42   sandPuddleUS02   66   graniteCliff03      
19   grassRough04   43   waterPuddle01       67   graniteCliff04      
20   grassDry01        44   asphalt01            
21   grassDry02        45   asphalt02            
22   grassDry03        46   asphalt03            
23   grassDry04        47   asphalt04            

The other method is to open the map i3d in notepad and rename the textures i.e.

        <Layer name="0_mudDark01" detailMapId="5" normalMapId="6" unitSize="1.5" weightMapId="3" blendContrast="0.5" distanceMapId="4" attributes="0.155 0.082 0.037 1 1" priority="0"/>
        <Layer name="1_mudDark02" detailMapId="8" normalMapId="9" unitSize="1.5" weightMapId="7" blendContrast="0.5" distanceMapId="4" attributes="0.155 0.082 0.037 1 1" priority="0"/>

this will then show in the Texture Layer drop down box as 0_mudDark01 and 1_mudDark02 with the combined layers showing as 71_GRASS, 72_GRASS_DRY

I have modified the script by adding  a couple of extra inputs to make it slightly more flexible, it now has the option to paint 3 separate textures at once, one in the middle, one on the left and one on the right or various  other combinations, further modification to this script now allows a width setting to the centre texture as well as separate textures for left and right or just one single texture across the whole width selected from the centre texture.
This revised script is attached to the end of this mini tutorial

Download the attached script and copy/paste it into Windows(C)--Users---Computer name---AppData--Local--GIANTS Editor 64bit 8.1.0-scripts

Open your map in GE and create a spline, adjust it to the shape required.


To alleviate any problems which can be caused by rotating the spline, the best way is to use just one end of the spline .

After creating the spline delete the “S” cv  (key “Delete”) it will be automatically reapplied to the next cv which is the original rotation point of the spline, then use the “E” cv to create your spline area, adding cv’s as necessary using the “Insert” key

This method also works when using the setTerrainHeightBySpline and Spline Placement scripts


Window--Script Editor and select the Paint Terrain By Spline_3 script which will open into the editor window

To use, enter the relevant information into the following locations

   Line 39 local offsetTexture = false - allows multiple textures when set to true, default is false
   Line 40 local texRight = Right hand texture,    
   Line 41 local texCentre = Centre texture
   Line 42 local texLeft = Left hand texture,
   Line 43 local numTex = Total Number of Textures in the Map-- needed to stop GE crashing if higher number inadvertently entered

   Chose width and distance and enter those in the relevant location

   Line 44 local mSideCount = 10 ---half the width in metres default 10m (gives 20M wide path)
   Line 45 local texCentreWidth = mSideCount  - 6 ---adjusts the width of centre texture by varying the figure, default 6  (in this case the texCentreWidth would be 4m)

   Line 49 local mSplinePiece =  how far apart the textures are along the length of the spline (0.5 default)
         If you have unpainted area’s which can occur especially where corners are created                           reduce this figure to 0.2 and re-execute the script (pic 3 gives an example of this in the bottom right of the picture)


 Select spline and execute script. WARNING texture cannot be undone but can be replaced by redoing with original texture or repainting with terrain detail brush.




One way to create a scene using 5 different textures



Final View


Have fun experimenting and don’t forget you can create your own new textures by making new combined layers in the map i3d.


There is also a slight anomaly when using the spline, the textures painted are not aligned to the centre of the spline but 1m to the left (when seen from the “S” cv) this is a result of the setTerrainLayerAtWorldPos function using the spline position as the start edge of the texture and not the midpoint.it also means there is an extra 1m section of the centre texture on the right (when seen from the “S” cv)  

So when requiring reasonably accurate placement of textures (roads etc) it is prudent to offset the spline left (when seen from the “S” cv) by 1m.


Share this post

Link to post
Share on other sites

The updated  scripts are available at the end of the Set Terrain Height, Paint Terrain and Spline PLacement SCripts tutorialthis section was done to explain the listings in the i3d and unfortunately I didn' update the download text.

  • Like 1

Share this post

Link to post
Share on other sites

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
Sign in to follow this  

  • Create New...