Version: 2019.1 (switch to 2018.3 or 2017.4)
LanguageEnglish
  • C#
Experimental: this API is experimental and might be changed or removed in the future.

TerrainPaintUtilityEditor.DrawBrushPreview

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

public static void DrawBrushPreview(Experimental.TerrainAPI.PaintContext heightmapPC, Experimental.TerrainAPI.TerrainPaintUtilityEditor.BrushPreview previewTexture, Texture brushTexture, Experimental.TerrainAPI.BrushTransform brushXform, Material proceduralMaterial, int materialPassIndex);

Parameters

heightmapPCPaintContext describing the heightmap from which to build the preview mesh.
previewTextureSpecifies Whether to build the mesh using the source or destination render texture in heightmapPC.
brushTextureThe brush texture to preview.
brushXformDescribes the position and orientation of the brush.
proceduralMaterialMaterial used to render the preview.
materialPassIndexMaterial pass to render.

Description

Draws a Terrain brush preview mesh from a heightmap PaintContext using the provided procedural material.

The heightmapPC is used to build the mesh. To ensure that the preview is rendered on the mesh, the heightmapPC must contain an area around the brush. To facilitate proper transformation of brush UV space, this method sets up the brush transforms in the material. Important: The material provided must support procedural mesh generation in the vertex shader using the shader functions provided in TerrainPreview.cginc. A default implementation of the material is provided by GetDefaultBrushPreviewMaterial().

See Also: TerrainPaintUtilityEditor.GetDefaultBrushPreviewMaterial and PaintContext.

Did you find this page useful? Please give it a rating: