MirceaKitsune wrote:MineTest
minetest.register_on_generated(function(minp, maxp, seed)
default.generate_ore("slab:dirt_with_grass_slab", "default:dirt_with_grass", minp, maxp, seed+0, 1/2/2/2, 1, 1, -100, 100)
end
menu wrote:[ X ] Smooth Terrain
rubenwardy wrote:Good idea, but as with every thing, make it configurablemenu wrote:[ X ] Smooth Terrain
mg_flags = smooth, ...
rubenwardy wrote:Good idea, but as with every thing, make it configurablemenu wrote:[ X ] Smooth Terrain
PilzAdam wrote:I am absolutely against this idea. Minetest consists of 1 m³ blocks and the main mapgen and most of the game elements should use this system. If you want smooth landscapes then you are wrong in Minetest.
rarkenin wrote:Or, make it that a special slab node is used for this, and depending on the setting, it will render as either a block or slab, so changes can be made in already-generated areas.
MirceaKitsune wrote:PilzAdam wrote:I am absolutely against this idea. Minetest consists of 1 m³ blocks and the main mapgen and most of the game elements should use this system. If you want smooth landscapes then you are wrong in Minetest.
It does consist of 1m blocks, but also of slabs / stairs and other nodeboxes which are part of Minetest just as much. I'm not suggesting we implement slabs since those exist for a long time... just defining dirt / sand ones and spawning them naturally in a correct pattern.
Otherwise that's not explaining why the idea would be bad. Being one of the main devs it would be useful to hear your point in more detail. Is it because of technical limitations, or artistic reasons? Like I said I'm not aware of anything that would make this impossible, since slabs can be defined for any material and the mapgen can spawn any node naturally.
As for making it customizable, that could be tricky since this would be done in LUA. But IIRC scripts can read settings from minetest.conf so it shouldn't be a problem. Fine by me, although I'd always keep it enabled and would suggest it being on by default.
PilzAdam wrote:My point is that slabs go against the voxel idea, wich is one of the main aspects of Minetest.
We can simply add round blocks but they wouldnt fit the voxel idea. Slabs arent that bad but adding them to the mapgen is. The main idea of the mapgen is to form realistic looking landscapes only with voxels. Adding slabs would make them look even more realistic, but it is against the main idea behind this whole game.
MirceaKitsune wrote:Another idea would be making natural blocks consumable, though this would require code changes and be a lot more complicated. So the more you dig a dirt block, the more it depletes and its surface lowers. Many mods could make use of such a thing, but in this case it probably couldn't be default and would take a lot of work and tweaking.
prestidigitator wrote:Don't liquids already break the voxel idea far worse than any half-block ever could? This idea has just recently been added for liquids ("finite liquids"), actually. Adding it as another use of "param1" or "param2" might not be a bad idea. It could go a long way toward giving us things like erosion, and will definitely help smooth out landscape, from mods if not from the basic mapgen.
with erosion we would need to have rivers in mapgen just have a pond with flowing water to lower levels. that means rivers with less the workprestidigitator wrote:MirceaKitsune wrote:Another idea would be making natural blocks consumable, though this would require code changes and be a lot more complicated. So the more you dig a dirt block, the more it depletes and its surface lowers. Many mods could make use of such a thing, but in this case it probably couldn't be default and would take a lot of work and tweaking.
Don't liquids already break the voxel idea far worse than any half-block ever could? This idea has just recently been added for liquids ("finite liquids"), actually. Adding it as another use of "param1" or "param2" might not be a bad idea. It could go a long way toward giving us things like erosion, and will definitely help smooth out landscape, from mods if not from the basic mapgen.
PilzAdam wrote:My point is that slabs go against the voxel idea, which is one of the main aspects of Minetest.
We can simply add round blocks but they wouldnt fit the voxel idea. Slabs arent that bad but adding them to the mapgen is. The main idea of the mapgen is to form realistic looking landscapes only with voxels. Adding slabs would make them look even more realistic, but it is against the main idea behind this whole game.
10twenty4 wrote:Slabs are essentially a half-voxel, so I fail to see what the issue is. Implementing them still maintains the voxel appearance, just at a slightly higher resolution. It's not like we're suggesting curved hills or angled ramps to connect blocks.
diff --git a/src/noise.cpp b/src/noise.cpp
index 49b5f7e..0dcc117 100644
--- a/src/noise.cpp
+++ b/src/noise.cpp
@@ -37,22 +37,89 @@
///////////////////////////////////////////////////////////////////////////////
-//noise poly: p(n) = 60493n^3 + 19990303n + 137612589
-float noise2d(int x, int y, int seed) {
+static inline int coordHash(int x, int y, int seed)
+{
int n = (NOISE_MAGIC_X * x + NOISE_MAGIC_Y * y
+ NOISE_MAGIC_SEED * seed) & 0x7fffffff;
n = (n >> 13) ^ n;
n = (n * (n * n * 60493 + 19990303) + 1376312589) & 0x7fffffff;
- return 1.f - (float)n / 0x40000000;
+ return n;
}
-
-float noise3d(int x, int y, int z, int seed) {
+static inline int coordHash(int x, int y, int z, int seed)
+{
int n = (NOISE_MAGIC_X * x + NOISE_MAGIC_Y * y + NOISE_MAGIC_Z * z
+ NOISE_MAGIC_SEED * seed) & 0x7fffffff;
n = (n >> 13) ^ n;
n = (n * (n * n * 60493 + 19990303) + 1376312589) & 0x7fffffff;
- return 1.f - (float)n / 0x40000000;
+ return n;
+}
+
+static inline float coordNoiseVal(int xi, float xf, int yi, float yf, int seed)
+{
+ int h = coordHash(xi, yi, seed);
+
+ int comps = h%2;
+ int signs = h/3;
+
+ float u, v;
+ switch (comps)
+ {
+ case 0:
+ u = 0.666667f*xf; v = 1.33333f*yf; break;
+ case 1:
+ u = 1.33333f*xf; v = 0.666667f*yf; break;
+ }
+ if (signs & 0x1)
+ {
+ u = -u;
+ }
+ if (signs & 0x2)
+ {
+ v = -v;
+ }
+
+ return u + v;
+}
+
+static inline float coordNoiseVal(int xi, float xf, int yi, float yf, int zi, float zf, int seed)
+{
+ int h = coordHash(xi, yi, zi, seed);
+
+ int comps = h%3;
+ int signs = h/3;
+
+ float u, v;
+ switch (comps)
+ {
+ case 0:
+ u = xf; v = yf; break;
+ case 1:
+ u = xf; v = zf; break;
+ case 2:
+ u = yf; v = zf; break;
+ }
+ if (signs & 0x1)
+ {
+ u = -u;
+ }
+ if (signs & 0x2)
+ {
+ v = -v;
+ }
+
+ return u + v;
+}
+
+
+//noise poly: p(n) = 60493n^3 + 19990303n + 137612589
+float noise2d(int x, int y, int seed) {
+ return 1.f - (float)coordHash(x, y, seed) / 0x40000000;
+}
+
+
+float noise3d(int x, int y, int z, int seed) {
+ return 1.f - (float)coordHash(x, y, z, seed) / 0x40000000;
}
@@ -96,99 +163,43 @@ float triLinearInterpolation(
}
-#if 0
-float triLinearInterpolation(
- float v000, float v100, float v010, float v110,
- float v001, float v101, float v011, float v111,
- float x, float y, float z)
-{
- /*float tx = easeCurve(x);
- float ty = easeCurve(y);
- float tz = easeCurve(z);*/
- float tx = x;
- float ty = y;
- float tz = z;
- return(
- v000 * (1 - tx) * (1 - ty) * (1 - tz) +
- v100 * tx * (1 - ty) * (1 - tz) +
- v010 * (1 - tx) * ty * (1 - tz) +
- v110 * tx * ty * (1 - tz) +
- v001 * (1 - tx) * (1 - ty) * tz +
- v101 * tx * (1 - ty) * tz +
- v011 * (1 - tx) * ty * tz +
- v111 * tx * ty * tz
- );
-}
-#endif
-
-
-#if 0
float noise2d_gradient(float x, float y, int seed)
{
- // Calculate the integer coordinates
- int x0 = (x > 0.0 ? (int)x : (int)x - 1);
- int y0 = (y > 0.0 ? (int)y : (int)y - 1);
- // Calculate the remaining part of the coordinates
- float xl = x - (float)x0;
- float yl = y - (float)y0;
- // Calculate random cosine lookup table indices for the integer corners.
- // They are looked up as unit vector gradients from the lookup table.
- int n00 = (int)((noise2d(x0, y0, seed)+1)*8);
- int n10 = (int)((noise2d(x0+1, y0, seed)+1)*8);
- int n01 = (int)((noise2d(x0, y0+1, seed)+1)*8);
- int n11 = (int)((noise2d(x0+1, y0+1, seed)+1)*8);
- // Make a dot product for the gradients and the positions, to get the values
- float s = dotProduct(cos_lookup[n00], cos_lookup[(n00+12)%16], xl, yl);
- float u = dotProduct(-cos_lookup[n10], cos_lookup[(n10+12)%16], 1.-xl, yl);
- float v = dotProduct(cos_lookup[n01], -cos_lookup[(n01+12)%16], xl, 1.-yl);
- float w = dotProduct(-cos_lookup[n11], -cos_lookup[(n11+12)%16], 1.-xl, 1.-yl);
- // Interpolate between the values
- return biLinearInterpolation(s,u,v,w,xl,yl);
-}
-#endif
+ int xi = myfloor(x);
+ int yi = myfloor(y);
+ float xf = x - xi;
+ float yf = y - yi;
+ float v00 = coordNoiseVal(xi, xf, yi, yf, seed);
+ float v10 = coordNoiseVal(xi+1, xf-1.0f, yi, yf, seed);
+ float v01 = coordNoiseVal(xi, xf, yi+1, yf-1.0f, seed);
+ float v11 = coordNoiseVal(xi+1, xf-1.0f, yi+1, yf-1.0f, seed);
-float noise2d_gradient(float x, float y, int seed)
-{
- // Calculate the integer coordinates
- int x0 = myfloor(x);
- int y0 = myfloor(y);
- // Calculate the remaining part of the coordinates
- float xl = x - (float)x0;
- float yl = y - (float)y0;
- // Get values for corners of square
- float v00 = noise2d(x0, y0, seed);
- float v10 = noise2d(x0+1, y0, seed);
- float v01 = noise2d(x0, y0+1, seed);
- float v11 = noise2d(x0+1, y0+1, seed);
- // Interpolate
- return biLinearInterpolation(v00,v10,v01,v11,xl,yl);
+ return biLinearInterpolation(v00, v10, v01, v11, xf, yf);
}
float noise3d_gradient(float x, float y, float z, int seed)
{
- // Calculate the integer coordinates
- int x0 = myfloor(x);
- int y0 = myfloor(y);
- int z0 = myfloor(z);
- // Calculate the remaining part of the coordinates
- float xl = x - (float)x0;
- float yl = y - (float)y0;
- float zl = z - (float)z0;
- // Get values for corners of cube
- float v000 = noise3d(x0, y0, z0, seed);
- float v100 = noise3d(x0 + 1, y0, z0, seed);
- float v010 = noise3d(x0, y0 + 1, z0, seed);
- float v110 = noise3d(x0 + 1, y0 + 1, z0, seed);
- float v001 = noise3d(x0, y0, z0 + 1, seed);
- float v101 = noise3d(x0 + 1, y0, z0 + 1, seed);
- float v011 = noise3d(x0, y0 + 1, z0 + 1, seed);
- float v111 = noise3d(x0 + 1, y0 + 1, z0 + 1, seed);
- // Interpolate
+ int xi = myfloor(x);
+ int yi = myfloor(y);
+ int zi = myfloor(z);
+ float xf = x - xi;
+ float yf = y - yi;
+ float zf = z - zi;
+
+ float v000 = coordNoiseVal(xi, xf, yi, yf, zi, zf, seed);
+ float v100 = coordNoiseVal(xi+1, xf-1.0f, yi, yf, zi, zf, seed);
+ float v010 = coordNoiseVal(xi, xf, yi+1, yf-1.0f, zi, zf, seed);
+ float v110 = coordNoiseVal(xi+1, xf-1.0f, yi+1, yf-1.0f, zi, zf, seed);
+ float v001 = coordNoiseVal(xi, xf, yi, yf, zi+1, zf-1.0f, seed);
+ float v101 = coordNoiseVal(xi+1, xf-1.0f, yi, yf, zi+1, zf-1.0f, seed);
+ float v011 = coordNoiseVal(xi, xf, yi+1, yf-1.0f, zi+1, zf-1.0f, seed);
+ float v111 = coordNoiseVal(xi+1, xf-1.0f, yi+1, yf-1.0f, zi+1, zf-1.0f, seed);
+
return triLinearInterpolation(v000, v100, v010, v110,
- v001, v101, v011, v111,
- xl, yl, zl);
+ v001, v101, v011, v111,
+ xf, yf, zf);
}
jojoa1997 wrote:i just read about voxels and actually a smooth sphere is a voxel. A voxel is anything that takes up space or has a volume so in reality minetest could be only smooth things because everything is a voxel. It is just the public that has made a slang version of voxel.
yes i knew that but what i was think of was a sphere is made of a ton of tiny voxels. just like i thought of making a map where you have a tnt block and then you are the energy inside of it.prestidigitator wrote:jojoa1997 wrote:i just read about voxels and actually a smooth sphere is a voxel. A voxel is anything that takes up space or has a volume so in reality minetest could be only smooth things because everything is a voxel. It is just the public that has made a slang version of voxel.
Hmm. Not sure where you read that, but it's not QUITE right. A "voxel" is the volume equivalent of a "pixel", hence the mash-up "volume-pixel -> voxel". In that sense a voxel really is supposed to be tileable in 3-space and treated like an atomic unit. However, there's no reason you can't render them using mathematically derived meshes, textures, etc. That's why I made up the term "voxture" above for node boxes: they act in a sense like a 3D/volumetric texture by choosing which parts of a voxel are solid and renderable. By simply storing a node type and using types to apply such data to many nodes across the map (as opposed to storing explicit mesh data for every piece of the map, for example) it is still definitely a voxel-based approach.
Mito551 wrote:http://forum.minetest.net/viewtopic.php?id=4739
there seems to be a connection...
Users browsing this forum: No registered users and 34 guests