The modified code I got from the yt tutorial, One question, I guess this make a random noise map, but how do I combine it with another noise map? etc like this, I have been struggling with this for 2 days, I have tried some formula by myself but it corrupt the map eventually
if chunkPosZ < Center and chunkPosX < Center then
offset = (chunkPosZ-1)(chunkPosX-1)/Center
else
if chunkPosZ > Center and chunkPosX > Center then
offset = (2Center+(-1*(chunkPosZ+chunkPosX)))/Center
else
if chunkPosZ >= Center and chunkPosX <= Center then
offset = (2Center+(-1(chunkPosZ-chunkPosX)))/Center
else
if chunkPosZ <= Center and chunkPosX >= Center then
offset = (2Center+(-1(chunkPosX-chunkPosZ)))/Center
else
offset = 2
end
end
end
How to put this gradient map into numerical values? Also, the problem with the map is that the map starts building from the edges instead of the center, and It comes with connections between wedges and trees which means editing the height of the map after structuring might corrupt the map? It’s gonna be a big appreciation if you can modify this code
I don’t think you understand, you can use math and code to generate a 2D array of numerical values assuming your noise map is also represented as a 2D array of numerical values. The combination of two maps will result in a new map aka another 2D array of numerical values. You don’t need external software or plugins.
Yeah I’m having problem combining 2 maps, Idk what I have to combine ( etc noise, CFrame ) Also I can’t combine CFrame cuz it will corrupt the map since its built with wedges. If i combie noise ( sometimes negative noise become positive )
You should probably make a function that calculates values between 0 and 1. Then just multiply the corresponding noise value with this value. And do that before creating the wedges.
I’m not sure if this function will give good results.
local arraySize = -- how many noise values there are in a row
local function getVal01(xScale, zScale)
return (math.sin(1 - math.abs(xScale * math.pi / 2)) + math.sin(1 - math.abs(zScale * math.pi / 2)) / 2
end
for xi, zArray in ipairs(noise2dArray) do
for zi, noiseValue in ipairs(yArray) do
zArray[zi] = noiseValue * getVal01(xi / (arraySize * .5), zi / (arraySize * .5))
end
end
Edit: I tested this and noticed that it doesn’t work the way I thought it would.
Edit: Here’s a function that creates a circle-like shape when drawn using 100 x 100 frames (0 = black, 1 = white). I wrote the function in a module script. You can get more higher or more lower values by using the easing functions.
local CircularGrayscale = {}
local function sineEase(val)
return math.sin(val * math.pi / 2)
end
local function cosEase(val)
return 1 - math.cos(val * math.pi / 2)
end
-- input values between -1 and 1, output value between 0 and 1
function CircularGrayscale.GetVal(xScale, yScale)
xScale, yScale = math.abs(xScale), math.abs(yScale)
local squaredDistToEdgeInXZDir = 1 + math.min(xScale, yScale)^2
local linear = 1 - math.sqrt( (xScale^2 + yScale^2) / squaredDistToEdgeInXZDir )
local val = linear ^ squaredDistToEdgeInXZDir
--val = sineEase(val)
--val = cosEase(val)
return val
end
return CircularGrayscale
I seem to be a bit late to this. Although I don’t have any code examples, I can say that what you are looking for is called a “falloff map” which brings the terrain gradually into the water rather than it just suddenly stopping.