DrawBrushPreview(PaintContext, TerrainBrushPreviewMode, Texture, BrushTransform, Material, int)
Draws a Terrain brush preview mesh from a heightmap PaintContext using the provided procedural material.
Read time 1 minuteLast updated 10 days ago
Definition
- Type: Method
- Namespace: UnityEditor.TerrainTools
- Assembly: UnityEditor
public static void DrawBrushPreview(PaintContext heightmapPC, TerrainBrushPreviewMode previewTexture, Texture brushTexture, BrushTransform brushXform, Material proceduralMaterial, int materialPassIndex)
Parameters
PaintContext describing the heightmap from which to build the preview mesh.
Specifies Whether to build the mesh using the source or destination render texture in heightmapPC.
The brush texture to preview.
Describes the position and orientation of the brush.
Material used to render the preview.
Material pass to render.
Remarks
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().
Additional Resources: TerrainPaintUtilityEditor.GetDefaultBrushPreviewMaterial and PaintContext.