Uploaded January 2022 | Updated September 2026, 1 week ago
From Boxes to photorealistic Fluid - how does ot work?
The fluid simulation is done with the lattice Boltzmann method (LBM) with the Volume-of-Fluid (VoF) extension and piecewise linear interface construction (PLIC) for surface tension.
VoF-LBM: researchgate.net/publication/349552856_High_Performance_Free_Surface_LBM_on_GPUs
PLIC: mdpi.com/2079-3197/10/2/21
VoF-LBM provides a 3D grid with fluid fill levels, used as isovalues for marching-cubes, which generates a contiguous triangle mesh representing the water surface.
Marching-cubes: paulbourke.net/geometry/polygonise
With raytracing I shoot light rays from the camera through the 3D isogrid. For each grid cell that a ray traverses, I run marching-cubes to generate the triangles on-the-fly, then check for ray-triangle intersections with any of these triangles. If the ray intersects, I don't use the flat-face-surface nromal of the triangle, as this would lead to visual artefacts on the reflected/refracted rays. Instead, I interpolate the surface normal at the intersection point in order to have a smoothly appearing surface. How does surface normal interpolation work with marching-cubes? I get the normals directly at the lattice points with gradient (central derivative) on the isogrid, then linearly interpolate to get the normals at triangle vertices and linearly interpolate again to where the ray intersects the triangle with Barycentric coordinates on the triangle.
The 3D lattice that the LBM provides already is one of the ideal acceleration structures for raytracing. Any ray only has to check for possible intersections with iso-surface triangles contained within the traversed grid cells. This makes it - when the lattice is not too large - even run in real time on non-RTX GPUs.
New video with surface normal interpolation: youtu.be/UUYrWUpPQwY
Old video without surface normal interpolation: youtu.be/9Rfu9ZqW894
The simulation setup you see here is a physically accurate 4mm diameter terminal velocity raindrop impact in water, although at rather low 256x256x218 resolution for this real time demo.
See my published research paper in Microplastics and Nanoplastics, where the simulation is validated to great extent:
microplastics.springeropen.com/articles/10.1186/s43591-021-00018-8
This simulation as well as the raytracing graphics are running in real time on a single Nvidia Titan Xp GPU.
The simulation software used is FluidX3D, an OpenCL implementation of the lattice Boltzmann method. FluidX3D runs at peak hardware efficiency on the worlds fastest data-center GPUs (8799/5232 MLUPs/s on the Nvidia A100/V100 @ D3Q19 SRT FP32), on gaming GPUs and CPUs and it even runs my smartphone.
For more performance details, see: arxiv.org/pdf/2112.08926.pdf
#FluidX3D #OpenCL #Raytracing #GPU #LBM
From Boxes to photorealistic Fluid - how does ot work?
The fluid simulation is done with the lattice Boltzmann method (LBM) with the Volume-of-Fluid (VoF) extension and piecewise linear interface construction (PLIC) for surface tension.
VoF-LBM: researchgate.net/publication/349552856_High_Performance_Free_Surface_LBM_on_GPUs
PLIC: mdpi.com/2079-3197/10/2/21
VoF-LBM provides a 3D grid with fluid fill levels, used as isovalues for marching-cubes, which generates a contiguous triangle mesh representing the water surface.
Marching-cubes: paulbourke.net/geometry/polygonise
With raytracing I shoot light rays from the camera through the 3D isogrid. For each grid cell that a ray traverses, I run marching-cubes to generate the triangles on-the-fly, then check for ray-triangle intersections with any of these triangles. If the ray intersects, I don't use the flat-face-surface nromal of the triangle, as this would lead to visual artefacts on the reflected/refracted rays. Instead, I interpolate the surface normal at the intersection point in order to have a smoothly appearing surface. How does surface normal interpolation work with marching-cubes? I get the normals directly at the lattice points with gradient (central derivative) on the isogrid, then linearly interpolate to get the normals at triangle vertices and linearly interpolate again to where the ray intersects the triangle with Barycentric coordinates on the triangle.
The 3D lattice that the LBM provides already is one of the ideal acceleration structures for raytracing. Any ray only has to check for possible intersections with iso-surface triangles contained within the traversed grid cells. This makes it - when the lattice is not too large - even run in real time on non-RTX GPUs.
New video with surface normal interpolation: youtu.be/UUYrWUpPQwY
Old video without surface normal interpolation: youtu.be/9Rfu9ZqW894
The simulation setup you see here is a physically accurate 4mm diameter terminal velocity raindrop impact in water, although at rather low 256x256x218 resolution for this real time demo.
See my published research paper in Microplastics and Nanoplastics, where the simulation is validated to great extent:
microplastics.springeropen.com/articles/10.1186/s43591-021-00018-8
This simulation as well as the raytracing graphics are running in real time on a single Nvidia Titan Xp GPU.
The simulation software used is FluidX3D, an OpenCL implementation of the lattice Boltzmann method. FluidX3D runs at peak hardware efficiency on the worlds fastest data-center GPUs (8799/5232 MLUPs/s on the Nvidia A100/V100 @ D3Q19 SRT FP32), on gaming GPUs and CPUs and it even runs my smartphone.
For more performance details, see: arxiv.org/pdf/2112.08926.pdf
#FluidX3D #OpenCL #Raytracing #GPU #LBM










![PhysX3D [GRAVITY SIMULATION] short galaxy demo
n-Körper-Simulationen gibt es viele, doch die wenigsten berücksichtigen die Gezeitenreibung und die auf den ersten Blick unscheinbare Konstante c – die Lichtgeschwindigkeit. Dass bewegte Massen schwerer sind ist eine der einfachen Folgen, die sich mit etwa zehn Zeilen Quellcode bewältigen lässt. Aber c verursacht noch ein weiteres Problem, ein sehr viel schwierigeres, das man erst bei genauerem Hinsehen bemerkt: Nichts kann sich schneller als c ausbreiten, eben auch nicht die Gravitation selbst.
Mein Programm kann sowohl Sonnensysteme als auch Kollisionen von Sternhaufen und Galaxien mit mehreren tausend Körpern relativistisch berechnen. Je nach Prozessorleistung sind bei Desktopcomputern bis zu 15 Millionen Rechenschritte pro Sekunde möglich.
Es enthält zudem verschiedene zuschaltbare Module, mit denen man beispielsweise die Raumkrümmung visualisieren kann oder zusätzliche Informationen zu den Körpern wie Flugbahn, Geschwindigkeit oder Gruppierungen von Körpern anzeigen kann.
Hier zu sehen ist ein Demonstrationsprogramm einer Galaxie aus 3000 Partikeln.
Mehr Informationen auf: http://www.projectphysx.de PhysX3D [GRAVITY SIMULATION] short galaxy demo](https://i.ytimg.com/vi/xgz18CcV0G8/mqdefault.jpg)