Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Spline-Road-Toolkit: Difference between revisions

From Farming Simulator Modding Wiki
No edit summary
No edit summary
Line 2: Line 2:


You can download it here: ย 
You can download it here: ย 
{{ExternalFileDownload|Spline-Road-Toolkit v2.0}}
{{ExternalFileDownload|Spline-Road-Toolkit v2.0}}





Revision as of 14:04, 25 January 2025

This is a toolkit for Giants Editor 10 to create roads, intersections and road markings from splines without the need for 3D-Moddeling software like blender.

You can download it here:

ย ย Spline-Road-Toolkit v2.0


The toolkit is split into 4 separate scripts:

  • ย ย  SplineToRoad.lua
  • ย ย  SplineToRoadMarkings.lua
  • ย ย  SplineToRoadIntersection.lua
  • SplineTool.lua

Installation

To install this toolkit, extract the lua files to: %localappdata%/GIANTS Software/Giants Editor 10.0.x/scripts/

Extract the textures folder into your map folder. There will already be a textures folder in your map, but dont worry, extracting this there should not overwrite any files. If you prefer, you can also directly extract the road folder that is inside the textures folder into your maps textures folder.

Remember to add these textures to any map you want to use this tool on.

You can also use your own custom road textures if you prefer. See the Usage section below for more info on that.

Now the scripts are installed and ready to use!

A note on the textures

The included textures are one simple asphalt texture which everyone may freely use with a diffuse, normal and specular. As different maps and different modders may prefer a darker or lighter road, the included asphalt01 - asphalt07 diffuse textures are replacements for the regular asphalt diffuse and they can be used with the same normal and specular as the asphalt diffuse. These alternative textures are lighter then the admittedly very dark default, with the asphalt07 being the lightest.

As stated above, you may use your own textures though.

Usage

Each of the three scripts will be accessible in Giants Editor (GE) via the Scripts -> User Scripts menu.

SplineToRoad

This script is used to create the roads themselves.

The script uses a single spline to create a road.

Place a spline where you want the road to be. The spline will be at the exact center of the road.

When you click on the script in the menu, a small window will open with the settings for the script.

These settings should be self-explanatory for the most part. The textures selected in the Material Settings will be used for the road itself. The lines do not use a texture.

The Line color sliders correspond to Red, Green and Blue from left to right. The buttons "White" and "Yellow" provide an easy way to select pure a pure white or a yellow color, as these are the most commonly used colors for road markings.

The settings "Widen at start of road" and "Widen at end of road" cause the road to become wider with an outward curve at the start or end respectively. This can be used for simple intersections, but does not offer much control over the shape.

For more complex intersections and more control over the exact shape of the intersection, use the SplineToRoadIntersection script.

The setting "Both Splines same direction", when checked, results in both traffic splines going the same direction. This can be used to create highways with 2 lanes per direction.

Should you wish to change the default textures, you can do so with the three file selectors in the Material Settings section. The top file selector sets the diffuse texture, the middle line sets the normal texture and the bottom line sets the specular texture.

Once you have chosen the settings you wish to use, make sure you have selected your spline in the scenegraph and click the "Generate Road" button.

The tool will now automatically generate a road based on your settings.

The resulting road will be placed in a transform group named "roads" at the bottom of the scenegraph.

You can now immediately select another spline in the scenegraph and click the "Generate Road" button again without having to close the tool.

If you are not happy with a road you generated, you can just delete it, by deleting its transform group inside the "roads" transform group. You can then select the same spline that you used before again, change the settings in the tool and click "Generate Road" again to re-create the road with the new settings.

Please Note: When using the "Create Water Puddle Surfaces" option, additional shapes will be created that will create water puddles during rain and wetness. You can see the effect by setting the wetness via the seasons visual control script. Please be aware that these shapes will need to be at terrain height, as this effect unfortunately does not work as a terrain decal. When using this option you may need to re-create the road after making changes to the terrain height.

SplineToRoadMarkings

This tool is used to create road markings on their own.

This is intended to be used in conjunction with the SplineToRoadIntersection tool to create the markings for an intersection, but can be used elsewhere too, if a few lines or a dashed line are needed.

Place a spline where you want the road markings. Then click on the script in the menu.

A small window will open with the settings for the script. These settings should be pretty self-explanatory.

By default, when "Solid Line" is not checked, a dashed line is created.

Like with the SplineToRoad tool the three sliders for line color represent Red, Green and Blue values respectively from left to right and the "White" and "Yellow" buttons provide easy access to predefined white and yellow colors respectively.

Once you have chosen the settings you want to use, make sure you have one or more splines selected in the scenegraph and click the "Generate Markings" button.

When you select multiple splines simultaneously and click the button, road markings with the same settings will be created for each selected spline.

The finished road markings are placed in a transform group named "roadMarkings" at the bottom of the scenegraph.

SplineToRoadIntersection

The SplineToRoadIntersection tool can be used to create complex road intersections.

In contrast to the other two tools, this tool requires multiple splines to create a single intersection.

A minimum of two splines are required, but for most intersections you will need 3 or 4 or even more splines.

The splines for this tool define the outline of the intersection.

Place splines along the outline of the intersection. These splines do not have to form a continuous outline. Gaps are allowed.

The tool will bridge gaps by connecting the end of one spline to the closest starting point of another spline.

The splines have to all run in counter-clockwise direction around the intersection!

After you have placed the splines, click on the script in the menu and a small window will open with the scripts settings.

In the Material Settings section, the top line allows selecting of a custom diffuse texture, the middle line selects the normal texture and the bottom line selects the specular texture.

The UV Scale slider determines the scale of the texture on the intersection. When you use custom textures you may need to adjust this in order for the texture to properly fit the intersection.

Be aware that a wrong setting here may cause a "UVs out of range" error! Should you see this error, delete the previously generated intersection and try again with a different UV Scale setting.

The three sliders for line color represent Red, Green and Blue values respectively from left to right and the "White" and "Yellow" buttons provide easy access to predefined white and yellow colors respectively.

Please Note: This tool cannot generate traffic splines or complex road markings. You will have to create traffic splines manually and for road markings you can use the SplineToRoadMarkings tool.

Please Note: When using the "Create Water Puddle Surfaces" option, a additional shape will be created that will create water puddles during rain and wetness. You can see the effect by setting the wetness via the seasons visual control script. Please be aware that this shape will need to be at terrain height, as this effect unfortunately does not work as a terrain decal. When using this option you may need to re-create the intersection after making changes to the terrain height.

To generate the intersection, make sure you have selected all of the splines for the outline of this intersection in the scenegraph and then click the "Generate intersection" button.

The created intersection will be placed in a transform group named "intersections" at the bottom of the scenegraph.

SplineTool

This is a tool for all sorts of spline related tasks. It can be used to get or set the exact coordinates for any spline control vertex (CV), to paint the terrain, terrainDetail, foliage, infoLayer or Procedural Placement masks around a spline and to align a spline to the terrain.

FAQ and known issues

I am getting "i3d contains non-binary indexed triangle sets" warnings

These warnings are normal and are expected for both the SplineToRoad and SplineToRoadIntersection tools. These warnings should only appear once for any given road or intersection, when the road or intersection is generated. When you have saved the map and reload it or load it ingame these warnings should not reappear.

If they reappear, even after closing and re-opening Giants Editor and without using the script again, go to File -> Save as... and select Binary i3d next to the filename in the save file dialog.

I clicked the button, but I cant see anything new

Wait a few seconds as it can take a moment for Giants Editor to update properly. In the scenegraph you may have to select a few different items before the new ones show up.

Should you still not see anything after a little while, try zooming in very close to the terrain as that can help to update it. Finally also check the console for any potential errors or messages from the script.

I want my roads to look snowy and frozen in the winter. How do I add the shader for this?

You dont have to. The scripts automatically add the basegame shader to all roads and intersections you create with them.

When you use the season toolkit and add snow, you should see your roads and intersections gettings a bit snowy. Note that in my experience Giants Editor can be a bit annoying and not properly update the view when you do this, so try zooming in very close to the road to update the visuals. Ingame this issue should not happen.

My intersections look weird with a custom texture

If you are using a custom road texture that has a "border" for the road on the texture, this texture is not suitable for use with the intersection tool. As intersections can take almost any arbitrary form it is effectively impossible to generate UVs that would allow for the use of such a texture. Use a texture that is only asphalt/road surface without a "border" instead.

Alternatively you could export the intersection shape as obj, import it in blender and UV map it in blender and then export it to i3d and import it into your map again.

The intersection was created wrong. The road is outside the intersection and there is nothing inside it

This may be caused by a particularly complex or weird shape for a intersection. This should be extremely rare.

If this happens, try deviding the intersection into two or more pieces and generating each piece individually.

If the road connections to the intersection are very far drawn out, this can also cause this. Try making the road connections that are part of the intersection shorter and bridge any potential gaps with the road tool.

The lines on the intersection are generated outside the intersection, next to the asphalt and not on it

When this happens, you probably got the direction of your spline wrong. Make sure they go in a counter clockwise fashion around the intersection.

If they currently do not, change the direction of the spline so they do, delete the wrong intersection and re-create it with the tool.

Terrain Decals, Roads disappearing after changes to the terrain

All the roads, lines and intersections created by these tools use the "terrain decal" functionality in FS 25.

This means that the roads, lines and intersections act like a texture on the terrain itself, so for the most part this means that if you make small adjustments to the terrain you will not need to change anything about the roads, lines or intersections as they should still be on the terrain.

If you make bigger terrain changes (like changing the height of the terrain by more then 20 meters at a road), this can however cause the roads, lines and/or intersections to disappear as the terrain ends up out of range from the actual shapes that are placed underneath the terrain.

To fix this you can either manually move the shapes (eg by moving the "roadPieces" transform group of a road) closer to the new terrain, or you can delete the old road and generate a new one. You can use the old spline again even if it is underground now. The height of the spline does not matter. The script always reads the height of the terrain itself.

Do I have to keep the splines used to generate the roads/lines/intersections?

No. These splines are only needed to generate the parts. When you are happy with the generated pieces you can delete the spline.

If I were you, I may keep all these splines around until the map is finished, just in case you want to make an adjustment or recreate a piece later.

When you are sure you will not need them again, you can delete them.

Cookies help us deliver our services. By using our services, you agree to our use of cookies.