Remove unnecessary smooth 3D noises. Squash 3D noise vertical scales. Flatter lowlands

This commit is contained in:
paramat 2014-04-30 07:32:01 +01:00
parent 123ab76e4f
commit dfb5a5660f
4 changed files with 16 additions and 66 deletions

View File

@ -1,4 +1,4 @@
watershed 0.3.14 by paramat watershed 0.3.15 by paramat
For latest stable Minetest back to 0.4.8 For latest stable Minetest back to 0.4.8
Depends default bucket Depends default bucket
Licenses: code WTFPL, textures CC BY-SA Licenses: code WTFPL, textures CC BY-SA

View File

@ -237,35 +237,19 @@ if SINGLENODE then
local np_rough = { local np_rough = {
offset = 0, offset = 0,
scale = 1, scale = 1,
spread = {x=512, y=512, z=512}, spread = {x=512, y=256, z=512},
seed = 593, seed = 593,
octaves = 6, octaves = 6,
persist = 0.67 persist = 0.67
} }
local np_smooth = {
offset = 0,
scale = 1,
spread = {x=512, y=512, z=512},
seed = 593,
octaves = 5,
persist = 0.33
}
local np_roughalt = { local np_roughalt = {
offset = 0, offset = 0,
scale = 1, scale = 1,
spread = {x=414, y=414, z=414}, spread = {x=414, y=207, z=414},
seed = -9003, seed = -9003,
octaves = 6, octaves = 6,
persist = 0.67 persist = 0.67
} }
local np_smoothalt = {
offset = 0,
scale = 1,
spread = {x=414, y=414, z=414},
seed = -9003,
octaves = 5,
persist = 0.33
}
local np_base = { local np_base = {
offset = 0, offset = 0,
scale = 1, scale = 1,
@ -297,9 +281,7 @@ if SINGLENODE then
local minposxz = {x=x0, y=z0} local minposxz = {x=x0, y=z0}
local nvals_rough = minetest.get_perlin_map(np_rough, chulens):get3dMap_flat(minposxyz) local nvals_rough = minetest.get_perlin_map(np_rough, chulens):get3dMap_flat(minposxyz)
local nvals_smooth = minetest.get_perlin_map(np_smooth, chulens):get3dMap_flat(minposxyz)
local nvals_roughalt = minetest.get_perlin_map(np_roughalt, chulens):get3dMap_flat(minposxyz) local nvals_roughalt = minetest.get_perlin_map(np_roughalt, chulens):get3dMap_flat(minposxyz)
local nvals_smoothalt = minetest.get_perlin_map(np_smoothalt, chulens):get3dMap_flat(minposxyz)
local nvals_base = minetest.get_perlin_map(np_base, chulens):get2dMap_flat(minposxz) local nvals_base = minetest.get_perlin_map(np_base, chulens):get2dMap_flat(minposxz)
local nvals_xlscale = minetest.get_perlin_map(np_xlscale, chulens):get2dMap_flat(minposxz) local nvals_xlscale = minetest.get_perlin_map(np_xlscale, chulens):get2dMap_flat(minposxz)
@ -310,19 +292,15 @@ if SINGLENODE then
for y = y0, y1 do for y = y0, y1 do
for x = x0, x1 do for x = x0, x1 do
local n_rough = nvals_rough[nixyz] local n_rough = nvals_rough[nixyz]
local n_smooth = nvals_smooth[nixyz]
local n_roughalt = nvals_roughalt[nixyz] local n_roughalt = nvals_roughalt[nixyz]
local n_smoothalt = nvals_smoothalt[nixyz]
local n_base = nvals_base[nixz] local n_base = nvals_base[nixz]
local n_xlscale = nvals_xlscale[nixz] local n_xlscale = nvals_xlscale[nixz]
local grad = math.atan((TERCEN - y) / TERSCA) * ATANAMP local grad = math.atan((TERCEN - y) / TERSCA) * ATANAMP
local densitybase = (1 - math.abs(n_base)) * BASAMP + n_xlscale * XLSAMP + grad local densitybase = (1 - math.abs(n_base)) * BASAMP + n_xlscale * XLSAMP + grad
local terblen = (math.max(1 - math.abs(n_base), 0)) ^ BLENEXP local terblen = (math.max(1 - math.abs(n_base), 0)) ^ BLENEXP
local canexp = 0.5 + terblen local canexp = 0.5 + terblen
local canamp = 0.03 + terblen * CANAMP local canamp = 0.01 + terblen * CANAMP
local density = densitybase + local density = densitybase + math.abs((n_rough + n_roughalt) * 0.5) ^ canexp * canamp
math.abs((n_rough + n_roughalt) * 0.5 * terblen +
(n_smooth + n_smoothalt) * 0.5 * (1 - terblen)) ^ canexp * canamp
if y >= 1 and density > -0.01 and density < 0 then if y >= 1 and density > -0.01 and density < 0 then
ysp = y + 1 ysp = y + 1
xsp = x xsp = x

View File

@ -1,13 +1,12 @@
-- watershed 0.3.14 by paramat -- watershed 0.3.15 by paramat
-- For latest stable Minetest and back to 0.4.8 -- For latest stable Minetest and back to 0.4.8
-- Depends default bucket -- Depends default bucket
-- License: code WTFPL, textures CC BY-SA -- License: code WTFPL, textures CC BY-SA
-- Red cobble texture CC BY-SA by brunob.santos -- Red cobble texture CC BY-SA by brunob.santos
-- light crafting gives 8 lights -- removed 2 unnecessary 3D noises for speed 4-5s per chunk
-- mid colour water at y == 2 -- squashed terrain noise
-- flatter lowlands: terblen exponent, vary canexp, canamp -- flattened lowlands
-- grassy sides on mod grass
-- Parameters -- Parameters
@ -31,7 +30,7 @@ local TSTONE = 0.02 -- Density threshold for stone, depth of soil at TERCEN
local TRIV = -0.02 -- Maximum densitybase threshold for river water local TRIV = -0.02 -- Maximum densitybase threshold for river water
local TSAND = -0.025 -- Maximum densitybase threshold for river sand local TSAND = -0.025 -- Maximum densitybase threshold for river sand
local TLAVA = 2.3 -- Maximum densitybase threshold for lava, small because grad is non-linear local TLAVA = 2.3 -- Maximum densitybase threshold for lava, small because grad is non-linear
local FISEXP = 0.03 -- Fissure expansion rate under surface local TFIS = 0.01 -- Fissure threshold, controls width
local ORETHI = 0.002 -- Ore seam thickness tuner local ORETHI = 0.002 -- Ore seam thickness tuner
local SEAMT = 0.2 -- Seam threshold, width of seams local SEAMT = 0.2 -- Seam threshold, width of seams
local BERGDEP = 32 -- Maximum iceberg depth local BERGDEP = 32 -- Maximum iceberg depth
@ -62,45 +61,23 @@ local DUGCHA = 5 -- Dune grass
local np_rough = { local np_rough = {
offset = 0, offset = 0,
scale = 1, scale = 1,
spread = {x=512, y=512, z=512}, spread = {x=512, y=256, z=512},
seed = 593, seed = 593,
octaves = 6, octaves = 6,
persist = 0.67 persist = 0.67
} }
-- 3D noise for smooth terrain
local np_smooth = {
offset = 0,
scale = 1,
spread = {x=512, y=512, z=512},
seed = 593,
octaves = 5,
persist = 0.33
}
-- 3D noise for alt rough terrain -- 3D noise for alt rough terrain
local np_roughalt = { local np_roughalt = {
offset = 0, offset = 0,
scale = 1, scale = 1,
spread = {x=414, y=414, z=414}, spread = {x=414, y=207, z=414},
seed = -9003, seed = -9003,
octaves = 6, octaves = 6,
persist = 0.67 persist = 0.67
} }
-- 3D noise for alt smooth terrain
local np_smoothalt = {
offset = 0,
scale = 1,
spread = {x=414, y=414, z=414},
seed = -9003,
octaves = 5,
persist = 0.33
}
-- 3D noise for fissures -- 3D noise for fissures
local np_fissure = { local np_fissure = {
@ -265,9 +242,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
local minposxz = {x=x0, y=z0} local minposxz = {x=x0, y=z0}
-- 3D and 2D perlinmaps -- 3D and 2D perlinmaps
local nvals_rough = minetest.get_perlin_map(np_rough, chulens):get3dMap_flat(minposxyz) local nvals_rough = minetest.get_perlin_map(np_rough, chulens):get3dMap_flat(minposxyz)
local nvals_smooth = minetest.get_perlin_map(np_smooth, chulens):get3dMap_flat(minposxyz)
local nvals_roughalt = minetest.get_perlin_map(np_roughalt, chulens):get3dMap_flat(minposxyz) local nvals_roughalt = minetest.get_perlin_map(np_roughalt, chulens):get3dMap_flat(minposxyz)
local nvals_smoothalt = minetest.get_perlin_map(np_smoothalt, chulens):get3dMap_flat(minposxyz)
local nvals_fissure = minetest.get_perlin_map(np_fissure, chulens):get3dMap_flat(minposxyz) local nvals_fissure = minetest.get_perlin_map(np_fissure, chulens):get3dMap_flat(minposxyz)
local nvals_temp = minetest.get_perlin_map(np_temp, chulens):get3dMap_flat(minposxyz) local nvals_temp = minetest.get_perlin_map(np_temp, chulens):get3dMap_flat(minposxyz)
local nvals_humid = minetest.get_perlin_map(np_humid, chulens):get3dMap_flat(minposxyz) local nvals_humid = minetest.get_perlin_map(np_humid, chulens):get3dMap_flat(minposxyz)
@ -295,9 +270,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
local si = x - x0 + 1 -- stable, under tables index local si = x - x0 + 1 -- stable, under tables index
-- noise values for node -- noise values for node
local n_rough = nvals_rough[nixyz] local n_rough = nvals_rough[nixyz]
local n_smooth = nvals_smooth[nixyz]
local n_roughalt = nvals_roughalt[nixyz] local n_roughalt = nvals_roughalt[nixyz]
local n_smoothalt = nvals_smoothalt[nixyz]
local n_fissure = nvals_fissure[nixyz] local n_fissure = nvals_fissure[nixyz]
local n_temp = nvals_temp[nixyz] local n_temp = nvals_temp[nixyz]
local n_humid = nvals_humid[nixyz] local n_humid = nvals_humid[nixyz]
@ -312,10 +285,8 @@ minetest.register_on_generated(function(minp, maxp, seed)
local densitybase = (1 - math.abs(n_base)) * BASAMP + n_xlscale * XLSAMP + grad local densitybase = (1 - math.abs(n_base)) * BASAMP + n_xlscale * XLSAMP + grad
local terblen = (math.max(1 - math.abs(n_base), 0)) ^ BLENEXP local terblen = (math.max(1 - math.abs(n_base), 0)) ^ BLENEXP
local canexp = 0.5 + terblen local canexp = 0.5 + terblen
local canamp = 0.03 + terblen * CANAMP local canamp = 0.01 + terblen * CANAMP
local density = densitybase + local density = densitybase + math.abs((n_rough + n_roughalt) * 0.5) ^ canexp * canamp
math.abs((n_rough + n_roughalt) * 0.5 * terblen +
(n_smooth + n_smoothalt) * 0.5 * (1 - terblen)) ^ canexp * canamp
-- other values -- other values
local triv = TRIV * (1 - terblen) -- river threshold local triv = TRIV * (1 - terblen) -- river threshold
local tsand = TSAND * (1 - terblen) -- sand threshold local tsand = TSAND * (1 - terblen) -- sand threshold
@ -325,7 +296,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
local bergdep = math.abs(n_seam) * BERGDEP -- iceberg depth local bergdep = math.abs(n_seam) * BERGDEP -- iceberg depth
local nofis = false -- set fissure bool local nofis = false -- set fissure bool
if math.abs(n_fissure) > math.sqrt(density) * FISEXP then if math.abs(n_fissure) >= TFIS then
nofis = true nofis = true
end end

View File

@ -196,6 +196,7 @@ minetest.register_node("watershed:cloud", {
drawtype = "glasslike", drawtype = "glasslike",
tiles = {"watershed_cloud.png"}, tiles = {"watershed_cloud.png"},
paramtype = "light", paramtype = "light",
is_ground_content = false,
sunlight_propagates = true, sunlight_propagates = true,
walkable = false, walkable = false,
pointable = false, pointable = false,