You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+13-3Lines changed: 13 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,10 +20,14 @@ As input, it supports particle positions from .vtk files and binary .xyz files (
20
20
The implementation first computes the density of each particle using the typical SPH approach with a cubic kernel.
21
21
This density is then evaluated or mapped onto a sparse grid using spatial hashing in the support radius of each particle.
22
22
This implies that memory is only allocated in areas where the fluid density is non-zero. This is in contrast to a naive approach where the marching cubes background grid is allocated for the whole domain.
23
-
Finally, the marching cubes reconstruction is performed only in those grid cells where the density values cross the surface threshold. Cells completely in the interior of the fluid are skipped.
23
+
Finally, the marching cubes reconstruction is performed only in those grid cells where the density values cross the surface threshold. Cells completely in the interior of the fluid are skipped. For more details, please refer to the [readme of the library]((https://github.com/w1th0utnam3/splashsurf/blob/master/splashsurf_lib/README.md)).
24
+
25
+
## Notes
24
26
25
27
Due the use of hash maps and multi-threading (if enabled), the output of this implementation is not deterministic.
26
-
In the future, flags may be added to switch the internally data structures to use binary trees for debugging.
28
+
In the future, flags may be added to switch the internal data structures to use binary trees for debugging purposes.
29
+
30
+
Note that for small numbers of fluid particles (i.e. in the low thousands or less) the multi-threaded implementation may have worse performance due to the worker pool overhead and looks on the map data structures (even though the library uses [`dashmap`](https://crates.io/crates/dashmap) which is more optimized for multi-threaded usage).
27
31
28
32
As shown below, the tool can handle the output of large simulations.
29
33
However, it was not tested with a wide range of parameters and may not be totally robust against corner-cases or extreme parameters.
@@ -130,6 +136,10 @@ With these parameters, a scene with 13353401 particles is reconstructed in nearl
130
136
[2020-08-25T15:52:59.879171+02:00][splashsurf][INFO] write surface mesh to file: 2.02%, 511.21ms/call @ 0.04Hz
131
137
```
132
138
139
+
### Sequences of files
140
+
141
+
*TODO: Describe syntax to reconstruct a sequence of files*
142
+
133
143
## Input file formats
134
144
135
145
*TODO: Document more details about the expected format of supported file extensions*
@@ -138,7 +148,7 @@ With these parameters, a scene with 13353401 particles is reconstructed in nearl
138
148
139
149
The ply format expects an element definition 'vertex', with element properties of 'x,y,z'
140
150
141
-
##License
151
+
# License
142
152
143
153
For license information of this project, see the LICENSE file.
144
154
The splashsurf logo is based on two graphics ([1](https://www.svgrepo.com/svg/295647/wave), [2](https://www.svgrepo.com/svg/295652/surfboard-surfboard)) published on SVG Repo under a CC0 ("No Rights Reserved") license.
Copy file name to clipboardExpand all lines: splashsurf/README.md
+13-3Lines changed: 13 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,10 +20,14 @@ As input, it supports particle positions from .vtk files and binary .xyz files (
20
20
The implementation first computes the density of each particle using the typical SPH approach with a cubic kernel.
21
21
This density is then evaluated or mapped onto a sparse grid using spatial hashing in the support radius of each particle.
22
22
This implies that memory is only allocated in areas where the fluid density is non-zero. This is in contrast to a naive approach where the marching cubes background grid is allocated for the whole domain.
23
-
Finally, the marching cubes reconstruction is performed only in those grid cells where the density values cross the surface threshold. Cells completely in the interior of the fluid are skipped.
23
+
Finally, the marching cubes reconstruction is performed only in those grid cells where the density values cross the surface threshold. Cells completely in the interior of the fluid are skipped. For more details, please refer to the [readme of the library]((https://github.com/w1th0utnam3/splashsurf/blob/master/splashsurf_lib/README.md)).
24
+
25
+
## Notes
24
26
25
27
Due the use of hash maps and multi-threading (if enabled), the output of this implementation is not deterministic.
26
-
In the future, flags may be added to switch the internally data structures to use binary trees for debugging.
28
+
In the future, flags may be added to switch the internal data structures to use binary trees for debugging purposes.
29
+
30
+
Note that for small numbers of fluid particles (i.e. in the low thousands or less) the multi-threaded implementation may have worse performance due to the worker pool overhead and looks on the map data structures (even though the library uses [`dashmap`](https://crates.io/crates/dashmap) which is more optimized for multi-threaded usage).
27
31
28
32
As shown below, the tool can handle the output of large simulations.
29
33
However, it was not tested with a wide range of parameters and may not be totally robust against corner-cases or extreme parameters.
@@ -130,6 +136,10 @@ With these parameters, a scene with 13353401 particles is reconstructed in nearl
130
136
[2020-08-25T15:52:59.879171+02:00][splashsurf][INFO] write surface mesh to file: 2.02%, 511.21ms/call @ 0.04Hz
131
137
```
132
138
139
+
### Sequences of files
140
+
141
+
*TODO: Describe syntax to reconstruct a sequence of files*
142
+
133
143
## Input file formats
134
144
135
145
*TODO: Document more details about the expected format of supported file extensions*
@@ -138,7 +148,7 @@ With these parameters, a scene with 13353401 particles is reconstructed in nearl
138
148
139
149
The ply format expects an element definition 'vertex', with element properties of 'x,y,z'
140
150
141
-
##License
151
+
# License
142
152
143
153
For license information of this project, see the LICENSE file.
144
154
The splashsurf logo is based on two graphics ([1](https://www.svgrepo.com/svg/295647/wave), [2](https://www.svgrepo.com/svg/295652/surfboard-surfboard)) published on SVG Repo under a CC0 ("No Rights Reserved") license.
Copy file name to clipboardExpand all lines: splashsurf_lib/README.md
+24-1Lines changed: 24 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,4 +23,27 @@ For each of the features, `splashsurf_lib` re-exports the corresponding dependen
23
23
24
24
## The surface reconstruction procedure
25
25
26
-
*TODO: Describe the surface reconstruction "algorithm" implemented in this crate*
26
+
Currently, only one method based on a "spatial hashing" strategy is implemented.
27
+
28
+
**Short summary**: The fluid density is evaluated or mapped onto a sparse grid using spatial hashing in the support radius of each fluid particle. This implies that memory is only allocated in areas where the fluid density is non-zero. This is in contrast to a naive approach where the marching cubes background grid is allocated for the whole domain. Finally, the marching cubes reconstruction is performed only in those grid cells where an edge crosses the surface threshold. Cells completely in the interior of the fluid are skipped in the marching cubes phase.
29
+
30
+
**Individual steps**:
31
+
1. Construct a "virtual background grid" with the desired resolution of the marching cubes algorithm. In the end, the procedure will place a single surface mesh vertex on each edge of this virtual grid, where the fluid surface crosses the edge (or rather, where the fluid density crosses the specified threshold). Virtual means that no storage is actually allocated for this grid yet; only its topology is used implicitly later.
32
+
2. Compute the density of each fluid particle
33
+
- Perform a neighborhood search
34
+
- Per particle, evaluate an SPH sum over the neighbors to compute its density (based on input parameters of kernel radius and particle rest mass)
35
+
3. Optional: filter out (or rather mask as inactive) single particles if the user provided a "splash detection radius". This is done by performing an additional neighborhood search using this splash detection radius instead of the kernel radius.
36
+
4. Compute a "sparse density map": a map from the index of a vertex of the virtual background grid to the corresponding fluid density value. The map will only contain entries for vertices where the fluid density is non-zero. Construction of the map:
37
+
- Iterate over all active particles
38
+
- For each particle evaluate its kernel at all virtual background vertices that can be influenced by it (i.e. vertices inside its kernel radius)
39
+
- Add-assign the corresponding density contribution (kernel value times particle density) to the vertex entry in the density map
40
+
5. Interpolate the density values at the vertices of each virtual background cell to points on the edges where the edge crosses the fluid surface
41
+
- Iterate over all vertices in the sparse density map
42
+
- Skip vertices where the density value is above the threshold to be considered inside of the fluid
43
+
- For each of the remaining vertices, check if any neighboring vertex (i.e. a vertex that is directly connected with it by an edge of the virtual background grid) is above the threshold
44
+
- If this is the case, an edge that crosses the fluid surface was found and the position of the surface on the edge can be calculated using linear interpolation
45
+
- This interpolated position is stored in a new map that maps indices of virtual background cells to structs containing the surface crossing points per edge. Entries are only created for cells with edges that actually cross the surface
46
+
6. Triangulate the points on the edges using a marching cubes case table
47
+
- Iterate over all cells in the cell data map
48
+
- For each cell, look up the corresponding triangulation in a marching cubes LUT
49
+
- Emit the required triangles into the final mesh data structure
0 commit comments