From dfb5a5660f1f2fef229459ed8f484f85be75e23b Mon Sep 17 00:00:00 2001 From: paramat Date: Wed, 30 Apr 2014 07:32:01 +0100 Subject: [PATCH] Remove unnecessary smooth 3D noises. Squash 3D noise vertical scales. Flatter lowlands --- README.txt | 2 +- functions.lua | 30 ++++-------------------------- init.lua | 49 ++++++++++--------------------------------------- nodes.lua | 1 + 4 files changed, 16 insertions(+), 66 deletions(-) diff --git a/README.txt b/README.txt index d5b5b54..8f578c2 100644 --- a/README.txt +++ b/README.txt @@ -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 Depends default bucket Licenses: code WTFPL, textures CC BY-SA diff --git a/functions.lua b/functions.lua index 8888d68..d981457 100644 --- a/functions.lua +++ b/functions.lua @@ -237,35 +237,19 @@ if SINGLENODE then local np_rough = { offset = 0, scale = 1, - spread = {x=512, y=512, z=512}, + spread = {x=512, y=256, z=512}, seed = 593, octaves = 6, 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 = { offset = 0, scale = 1, - spread = {x=414, y=414, z=414}, + spread = {x=414, y=207, z=414}, seed = -9003, octaves = 6, 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 = { offset = 0, scale = 1, @@ -297,9 +281,7 @@ if SINGLENODE then local minposxz = {x=x0, y=z0} 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_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_xlscale = minetest.get_perlin_map(np_xlscale, chulens):get2dMap_flat(minposxz) @@ -310,19 +292,15 @@ if SINGLENODE then for y = y0, y1 do for x = x0, x1 do local n_rough = nvals_rough[nixyz] - local n_smooth = nvals_smooth[nixyz] local n_roughalt = nvals_roughalt[nixyz] - local n_smoothalt = nvals_smoothalt[nixyz] local n_base = nvals_base[nixz] local n_xlscale = nvals_xlscale[nixz] local grad = math.atan((TERCEN - y) / TERSCA) * ATANAMP local densitybase = (1 - math.abs(n_base)) * BASAMP + n_xlscale * XLSAMP + grad local terblen = (math.max(1 - math.abs(n_base), 0)) ^ BLENEXP local canexp = 0.5 + terblen - local canamp = 0.03 + terblen * CANAMP - local density = densitybase + - math.abs((n_rough + n_roughalt) * 0.5 * terblen + - (n_smooth + n_smoothalt) * 0.5 * (1 - terblen)) ^ canexp * canamp + local canamp = 0.01 + terblen * CANAMP + local density = densitybase + math.abs((n_rough + n_roughalt) * 0.5) ^ canexp * canamp if y >= 1 and density > -0.01 and density < 0 then ysp = y + 1 xsp = x diff --git a/init.lua b/init.lua index 85ce8b4..e0c43aa 100644 --- a/init.lua +++ b/init.lua @@ -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 -- Depends default bucket -- License: code WTFPL, textures CC BY-SA -- Red cobble texture CC BY-SA by brunob.santos --- light crafting gives 8 lights --- mid colour water at y == 2 --- flatter lowlands: terblen exponent, vary canexp, canamp --- grassy sides on mod grass +-- removed 2 unnecessary 3D noises for speed 4-5s per chunk +-- squashed terrain noise +-- flattened lowlands -- 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 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 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 SEAMT = 0.2 -- Seam threshold, width of seams local BERGDEP = 32 -- Maximum iceberg depth @@ -62,45 +61,23 @@ local DUGCHA = 5 -- Dune grass local np_rough = { offset = 0, scale = 1, - spread = {x=512, y=512, z=512}, + spread = {x=512, y=256, z=512}, seed = 593, octaves = 6, 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 local np_roughalt = { offset = 0, scale = 1, - spread = {x=414, y=414, z=414}, + spread = {x=414, y=207, z=414}, seed = -9003, octaves = 6, 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 local np_fissure = { @@ -265,9 +242,7 @@ minetest.register_on_generated(function(minp, maxp, seed) local minposxz = {x=x0, y=z0} -- 3D and 2D perlinmaps 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_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_temp = minetest.get_perlin_map(np_temp, 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 -- noise values for node local n_rough = nvals_rough[nixyz] - local n_smooth = nvals_smooth[nixyz] local n_roughalt = nvals_roughalt[nixyz] - local n_smoothalt = nvals_smoothalt[nixyz] local n_fissure = nvals_fissure[nixyz] local n_temp = nvals_temp[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 terblen = (math.max(1 - math.abs(n_base), 0)) ^ BLENEXP local canexp = 0.5 + terblen - local canamp = 0.03 + terblen * CANAMP - local density = densitybase + - math.abs((n_rough + n_roughalt) * 0.5 * terblen + - (n_smooth + n_smoothalt) * 0.5 * (1 - terblen)) ^ canexp * canamp + local canamp = 0.01 + terblen * CANAMP + local density = densitybase + math.abs((n_rough + n_roughalt) * 0.5) ^ canexp * canamp -- other values local triv = TRIV * (1 - terblen) -- river 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 nofis = false -- set fissure bool - if math.abs(n_fissure) > math.sqrt(density) * FISEXP then + if math.abs(n_fissure) >= TFIS then nofis = true end diff --git a/nodes.lua b/nodes.lua index 705472e..b35ec9f 100644 --- a/nodes.lua +++ b/nodes.lua @@ -196,6 +196,7 @@ minetest.register_node("watershed:cloud", { drawtype = "glasslike", tiles = {"watershed_cloud.png"}, paramtype = "light", + is_ground_content = false, sunlight_propagates = true, walkable = false, pointable = false,