- Home /
Question by
abinitio · Dec 14, 2019 at 12:20 AM ·
terrainterrain-editor
Weird heightmap painting issues
hello there
Im trying to use the new terrain api, to make a run-time terrain editor
using this code:
Material mat = TerrainPaintUtility.GetBuiltinPaintMaterial();
BrushTransform brushXform = TerrainPaintUtility.CalculateBrushTransform(terrain, new Vector2(0.12f, 0.07f), 150, 0);
PaintContext paintContext = TerrainPaintUtility.BeginPaintHeightmap(terrain, brushXform.GetBrushXYBounds());
// apply brush
Vector4 brushParams = new Vector4(0.004f * Time.deltaTime * BrushStrength, 0.0f, 0.0f, 0.0f);
mat.SetTexture("_BrushTex", texture);
mat.SetVector("_BrushParams", brushParams);
TerrainPaintUtility.SetupTerrainToolMaterialProperties(paintContext, brushXform, mat);
Graphics.Blit(paintContext.sourceRenderTexture, paintContext.destinationRenderTexture, mat, (int)TerrainPaintUtility.BuiltinPaintMaterialPasses.RaiseLowerHeight);
TerrainPaintUtility.EndPaintHeightmap(paintContext, "Terrain Paint");
TerrainPaintUtility.ReleaseContextResources(paintContext);
for some reason when i try to paint height it gives this weird shape

even though i used this brush texture: 
even weirder is that the pattern (the heights of steps) seems to be random
the brush texture is imported as R 16 bit
does anyone have any idea what could be causing this?
bug.png
(186.9 kB)
untitled.png
(46.5 kB)
Comment
Your answer
Follow this Question
Related Questions
Problem with Terrain Paint Details Tool,Problems Using Terrain Paint Detail Tool 0 Answers
Terrain Issue [Video] 1 Answer
Process heavy issues 0 Answers
terrain engine with holes 0 Answers
Unity 5 Terrain glitch 0 Answers