- /
-
Procedural sand ripples
on 18 Oct 2021
- 6
- 83
- 4
- 0
- 277
N=400;
H=randn(N);
[y,x]=meshgrid(1:N);
for n=1:200
d=H-circshift(H,1);
g=(1+tanh(d))*0.5;
L=10.*(1-tanh(d));
m=mod(round(x+randn(1)*7)-1,N)+1;
o=mod(round(y+L)-1,N)+1;
ig=accumarray([m(:),o(:)],g(:),[N,N]);
H=H-g+ig;
H=conv2(H,ones(3)/9,'same');
end
imshow(diff(H'))
colormap(copper.^0.5)
caxis([-3,5])