Terrain To Mesh
  • Terrain To Mesh
  • Quick Start
  • Editor Window Settings
    • Mesh
    • Material
    • Objects
    • Save
  • Update Splatmap Shader
  • Run-time API
    • TerrainToMesh
      • ExportMesh
      • ExportTerrainLayers
      • ExportSplatmapMaterial
      • ExportSplatmapTextures
      • HasHoles
      • ExportHolesmapTexture
      • ExportBasemapDiffuseTexture
      • ExportBasemapNormalTexture
      • ExportBasemapMaskTexture
      • ExportBasemapOcclusionTexture
      • ExportGrassTextures
      • ExportGrassAtlasTexture
      • HasPrototypes
      • CountPrototypes
      • ExportPrototypes
    • TerrainToMeshUtilities
      • GenerateGrassMesh
      • GenerateEdgeFallTexture
      • ConvertMeshToOBJ
      • ConvertMeshToOBJAndSaveToFile
      • ConvertMeshToOBJAndAppendToFile
      • GetDefaultMaterial
      • GetDefaultShader
      • GetDefaultShaderProperty
      • SetupDefaultMaterial
      • SetupAlphaCutoutForDefaultMaterial
      • ConvertPrototypesToTreeGameObjects
      • ConvertPrototypesToGrassGameObjects
      • ConvertPrototypesToGrassMeshes
      • ConvertPrototypesToDetailMeshGameObjects
      • ConvertPrototypesToDetailMeshes
      • CalculateExportedMeshVertexCount
      • SetMeshPivotPoint
    • TerrainToMeshEdgeFall
    • TerrainToMeshPrototype
    • TerrainToMeshConversionDetails
  • Help & Contact
Powered by GitBook
On this page
PreviousExportTerrainLayersNextExportSplatmapTextures

Last updated 1 month ago

Export Splatmap Material

Material ExportSplatmapMaterial(bool hasHolesmap, bool enableHeightBasedBlend = false, float heightTransition = 0)

Generates TTM Splatmap material same as using the editor tool. Material imitates Unity's built-in terrain shader and can render 16 layers (with their own Diffuse/Normal/Mask maps) using one shader pass and with textures in original resolution. However rendered textures count may be limited on WebGL and mobile devices.

For limitations of the Splatmap material check chapter.

By default object doesn't use Height Based Blend feature. This is optional feature for the terrain material and if converted terrain uses it, it needs to be manually set inside ExportSplatmapMaterial method:

Material's height based blend values can be read using TerrainToMeshUtilities.GetTerrainMaterialHeightBasedBlendSettings method.


Material ExportSplatmapMaterial(Texture2DArray splatmaps, Texture2DArray diffusemaps, Texture2DArray normalmaps, Texture2DArray maskmaps, bool hasHolesmap, bool enableHeightBasedBlend = false, float heightTransition = 0)

Generates TTM Splatmap material same as using the editor tool but all textures need to be manually packed into .

Texture2DArray
Material
TerrainData