//sculpt: Add buffer to catch height variations in terrain

This commit is contained in:
Starbeamrainbowlabs 2021-12-28 19:04:13 +00:00
parent be7d46740a
commit b0e0b83c0d
No known key found for this signature in database
GPG Key ID: 1BE5172E637709C2
2 changed files with 6 additions and 6 deletions

@ -21,8 +21,11 @@ local function apply(pos1, brush_name, height, brush_size)
)
local brush_size_radius = (brush_size_terrain / 2):floor()
local pos1_compute = pos1 - brush_size_radius
local pos2_compute = pos1 + brush_size_radius + Vector3.new(0, height, 0)
-- To try and make sure we catch height variations
local buffer = Vector3.new(0, math.min(height*2, 100), 0)
local pos1_compute = pos1 - brush_size_radius - buffer
local pos2_compute = pos1 + brush_size_radius + Vector3.new(0, height, 0) + buffer
pos1_compute, pos2_compute = Vector3.sort(
pos1_compute,

@ -10,9 +10,6 @@ return function(size)
local border = 1
local kernel_size = 3
local kernel_size_vec = {}
kernel_size_vec[0] = kernel_size
kernel_size_vec[1] = kernel_size
-- Make the circle
-- We don't use 0 to 1 here, because we have to blur it and the existing convolutional
@ -35,7 +32,7 @@ return function(size)
local success2, msg = worldeditadditions.conv.convolve(
brush, Vector3.new(size.x, 0, size.y),
kernel, kernel_size_vec
kernel, Vector3.new(kernel_size, 0, kernel_size)
)
if not success2 then return success2, msg end