Skip to content
This repository was archived by the owner on Nov 14, 2024. It is now read-only.

2. Conversion Tab

Halil Emre Yildiz edited this page Jan 13, 2024 · 11 revisions

The Conversion tab contains the Scanner, Printer and Mesher tools that allow you to convert a Terrain object into different formats.


Scanner Tool

Scanner is a tool that allows you to create a heightmap of a Terrain object or other objects in the scene. This tool uses physical collision tests to scan the height values of a certain area and saves them as a Texture2D.




Usage

To use the Scanner tool, follow these steps:

  1. Select the Conversion tab and enable the Scanner tool.
  2. Check the Area Heightmapper option to visually adjust the area that you want to scan. This area is determined by the position, rotation and scale of the Scanner object.
  3. In the Scanner Settings section, select the tags or layers that you want to scan. The TagMask option ignores tags if it is Untagged, or scans only objects with selected tags if it is Scans only selected tags. The LayerMask option scans only objects with selected layers.
  4. In the Heightmapper Settings section, adjust the way the heightmap is created. The MappingMode option scans from bottom to top if it is BottomUp, or from top to bottom if it is TopDown. The Radius option determines the radius of the Collision method used for each pixel. The Contrast option determines the number of vertical Collision methods used for each pixel. The Resolution option determines the resolution of the heightmap.
  5. Click on the Generate Heightmap button to create the heightmap. The heightmap is saved in the Assets/_JSG_DATA/Heightmaps folder.

Variables

The variables and UI elements of the Scanner tool are as follows:

public Terrain Terrain; 
public bool AreaHeightmapper; // Check to visually adjust the area that you want to scan
[Header("Scanner Settings")]
public TagMaskEnum TagMask = Untagged; // Select the tags that you want to scan. Untagged = Ignores tags, Scans only selected tags = Scans only objects with selected tags
public LayerMask LayerMask = Mixed; // Select the layers that you want to scan. Scans only objects with selected layers
[Header("Heightmapper Settings")]
public MappingModeEnum = BottomUp; // The way the heightmap is created. BottomUp = Scans from bottom to top, TopDown = Scans from top to bottom
[Range(0.025f, 1f)] public float Radius = 0.05; // The radius of the Collision  method used for each pixel
[Range(100, 10000)] public int Contrast = 2500; // The number of vertical Collision  methods used for each pixel
public Vector2Int Resolution = Vector2Int.One * 513; // The resolution of the heightmap
[Button("Generate Heightmap")] GenerateHeightmap(Path = "Assets/_JSG_DATA/Heightmaps"); // The Generate Heightmap button, which creates the heightmap and saves it to the specified folder

Printer Tool

The Printer tool allows you to add objects to a Terrain, paint the heightmap, and more. The tool includes options for area heightmap applier, snap scanner area, snap terrain area, and offset mode.




Usage

To use the Printer tool, follow these steps:

  1. Select the Conversion tab and activate the Printer tool.
  2. In the "Area Options" section, adjust the "Snap Scanner Area", "Snap Terrain Area", and "Offset Mode" options as desired.
  3. In the "Paint Mode" section, follow the instructions to paint the heightmap.
  4. In the "Applier Settings" section, adjust the "Height Offset", "Alpha Blend", "Mask Blend", and "Edit Heightmap Texture Flag" options as desired.
  5. Click the "Select Heightmap" button to select a heightmap to use.
  6. Click the "Apply Heightmap" button to apply the heightmap to the Terrain.

Variables

The variables and UI elements of the Printer tool are as follows:

public Terrain Terrain; 
public bool AreaHeightmapApplier;
[Header("Area Options")]
public bool SnapScannerArea;
public bool SnapTerrainArea;
public OffsetMode offsetMode = OffsetMode.center; // { none, min, center, max }
[Header("Paint Mode")]
public bool paintMode;
[Header("Applier Settings")]
public float heightOffset;
public BlendMode alphaBlend = BlendMode.none; // none, normal, add, subtract, multiply, divide, invert
public BlendMode maskBlend = BlendMode.normal; // none, normal, add, subtract, multiply, divide, invert
[Button("Select Heightmap")] SelectHeightmap(Path = "Assets/_JSG_DATA/Heightmaps");
[Button("Apply Heightmap")] ApplyHeightmap(Path = "Assets/_JSG_DATA/Heightmaps");

Mesher Tool

The Mesher tool allows you to export the Terrain as an OBJ file. The tool includes options for export format and resolution.




Usage

To use the Mesher tool, follow these steps:

  1. Select the Conversion tab and activate the Mesher tool.
  2. Choose the Terrain object you want to export.
  3. In the "Obj Settings" section, adjust the "Export Format" and "Export Resolution" options as desired.
  4. Click the "Export" button to export the Terrain as an OBJ file.

Variables

The variables and UI elements of the Mesher tool are as follows:

public Terrain Terrain;
[Header("Obj Settings")]
public enum FaceType { Triangles, Quads }
public enum Resolution { Full = 0, Half, Quarter, Eighth, Sixteenth }
[Button("Export")] Export(Terrain, Path = "Assets/_JSG_DATA/Terrain Mesh"); 

Clone this wiki locally