1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-03-14 11:10:01 +01:00

change params

This commit is contained in:
Justin Lin 2022-04-01 17:11:29 +08:00
parent 356966b8f6
commit 4e0078f25c

View File

@ -1,11 +1,12 @@
use <noise/nz_worley2.scad>;
use <noise/nz_perlin3.scad>;
use <noise/nz_perlin2.scad>;
use <surface/sf_thicken.scad>;
size = [100, 100];
grid_w = 5;
amplitude = 3;
detail = 5;
size = [30, 30];
grid_w = 15;
amplitude = 1;
mesh_w = 0.2;
wave_smoothness = 20;
thickness = 0.5;
dist = "euclidean"; // [euclidean, manhattan, chebyshev, border]
seed = 51;
@ -13,27 +14,24 @@ seed = 51;
ripples();
module ripples() {
points = [
for(y = [0:size.y - 1])
for(x = [0:size.x - 1])
[x, y]
];
point_size = size / mesh_w;
cells = [for(p = points) nz_worley2(p.x / detail, p.y / detail, seed, grid_w, dist)];
points = [for(y = [0:point_size.y - 1], x = [0:point_size.x - 1]) [x, y] * mesh_w];
detail2 = detail / 2 * 10;
nz2 = [
for(y = [0:size.y - 1])
[for(x = [0:size.x - 1])
noise = [for(p = points) nz_worley2(p.x, p.y, seed, grid_w, dist)[2]];
sf = [
for(y = [0:point_size.y - 1])
[for(x = [0:point_size.x - 1])
let(
i = size.x * y + x,
i = point_size.x * y + x,
nz = noise[i],
p = points[i],
n = amplitude * nz_perlin3(cells[i][2], p.x / detail2, p.y / detail2, 1)
n = amplitude * nz_perlin2(nz + p.x / wave_smoothness, nz + p.y / wave_smoothness, seed)
)
[p.x, p.y, n]
]
];
sf_thicken(nz2, thickness);
sf_thicken(sf, thickness);
}