Skip to content

Spline Stamper is a Unity Terrain extension tool that allows you to quickly create paths, ramps, rivers and many other things using Native Unity Terrain.

License

Notifications You must be signed in to change notification settings

Rumesic/spline-stamper-unity-terrain-tool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spline Stamper | Unity Terrain Extention Tool

Final Major Project | Games Art @ Royal Leamington Spa College | Work in Progress

Spline Stamper is a Unity Terrain extension tool that allows you to quickly create paths, ramps, rivers and many other things using Native Unity Terrain. Add, delete, insert and move points to get the shape you want, the Terrain will automatically adjust both its Heightmap and Alphamap / Splatmap.

Programming-3D-Artist-Demo-Reel

Components

  1. SplineStamper is the main component that allows you to create Stampers. In should be attached to the Terrain Component.

image

  • Create New Stamper – Creates a new Stamper as a child of SplineStamper
  1. Stampers are created as child objects of SplineStamper. They manipulate TerrainData and perform most of the necessary calculations. You can have unlimited number of Stampers but crossing them can sometimes lead to unexpected results. You can easily add new stampers by holding CTRL and clicking on the Terrain.

Make sure that the Gizmos are enabled in the scene view to edit the Spline.

image

  • Path Width – Controls the width of the path
  • Texture Layer – Which Terrain Layer the Stamper will use as main
  • Falloff Distance – Adds extra width on both sides to smooth the terrain
  • Falloff Texture Layer – Which Terrain Layer the Stamper will use for slopes
  • Spacing – Distance between internal points used by MeshCreator and SplineFollower
  • Show Spacing Gizmo – This will enable additional gizmos that allow you to see the spacing. Useful when working with MeshCreator or SplineFollower but can be resource intensive.
  • Toggle Closed – Switches between Open and Closed Loop
  • Manual Stamp – Manually stamps the terrain.
  • Manual Undo – Manually removes the stamps on the terrain
  • Create Spline Follower – Creates a child object capable of following the curve
  1. SplineFollower is a component that allows you to make objects follow along the curve. You can set the position by changing PointPosition in the inspector and offset it to either side using Width and Side. Setting FacePoint to true will make the object face the center position, no matter which side it is on. You can have as many SplineFollowers as you want under each Stamper. After creating the SplineFollower, simply add GameObjects as child objects to make them follow the curve.

image

  • Point Position – Position on the curve the object will Follow normalised to 0-1 range.
  • Side – Offset that allows you to define the side and the offset amount
  • Width- Maximum offset allowed
  • Face Point – If set to on, the object will LookAt the center position.
  • Display Gizmos – Visualise the SplineFollower position

image

  1. MeshCreator component allows you to generate a mesh based on the curve you define. Useful for creating rivers and mesh-based paths such as railroads. It will update automatically with each change if “AutoUpdate” is set to on. It should be added on the same GameObject with the Stamper component. Its resolution is based on the Spacing from Stamper component. You can apply any material / shader to it.

image

  • Extra Width – Extrudes the mesh by defined amount to cover additional area.
  • Height Offset – Offsets the mesh on Y axis.
  • Auto Update – If set to on mesh will be updated on each curve change.

image

Known Issues

  • Heightmap Resolution and Control Texture Resolution of the Terrain can be changed dynamically, but only Ascending. Decreasing either of the two will break stamperData.
  • Mesh created by MeshCreator has broken UVs on some points and inverted Normals, requiring emission texture to be added.
  • Overlaping paths might lead to unxpected results after reloading the scene. Probably wrong Undo calculations.

Credits

Big thanks to Sebastian Lague for his tutorial on 2D Curve editor which allowed me to start working on this tool.

About

Spline Stamper is a Unity Terrain extension tool that allows you to quickly create paths, ramps, rivers and many other things using Native Unity Terrain.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages