O is your starting fluid-column
o are diffusing columns
************************
X X X X X
X X X X X
X X O X X
X X X X X
X X X X X
************************
--Get the Laplacian of the heights of each neighbour and accumulate results
in a separate matrix
--Then apply the second matrix into first one to do synchronous diffusion
--go to Laplacian step again and again
************************
X X X X X
X X o X X
X o O o X
X X o X X
X X X X X
************************
************************
X X . X X
X . o . X
. o O o .
X . o . X
X X . X X
************************
************************
X X . X X
X o o o X
. o o o .
X o o o X
X X . X X
************************
************************
X X . X X
X o o o X
. o o o .
X o o o X
X X . X X
************************
************************
X . o . X
. o o o .
o o o o o
. o o o .
X . o . X
************************
************************
. . . . .
. o o o .
. o o o .
. o o o .
. . . . .
************************
************************
. . . . .
. . . . .
. . o . .
. . . . .
. . . . .
************************
************************
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
************************
sorry for very low height-resolution
拉普拉斯算子
拉普拉斯在扩散中的位置
扩散在 Navier-Stokes 方程中的位置
离散拉普拉斯算子
简单算法(伪):
get a cell's value in a.
get neighbour cells' values in b(sum of them)
put b/4.0 in c(getting 4 cells' values)
add a to c
build a matrix with this algorithm
apply the matrix onto old one
goto step 1
更难的算法(伪):
apply discrete-Laplacian-operator on all neighbours(finite-differences thing)
put solution in c height-map
subtract or add c to/from starting height-map
goto step 1
Jos Stam 的流体求解器在扩散部分也有类似的东西。