SPH Fluid Density texture
OpenPublic

Description

This patch adds a new texture type for rendering SPH fluids. It is based on the Point Density texture, but on each sample, the actual SPH field variables are used to colour the surface. Like Point Density, this can also be used with a volumetric material to visualise the shape of the particle system.

This patch overlaps a little with 29661 and 29663 (bug fixes and refactoring). However the patch provided (fluidDensity_r42811_1_svn.patch) applies against trunk (r42811) and does not need other patches applied first.

By making a contribution to this project, I certify that the contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file.

Signed-off-by: Alex Fraser <adfries@vpac.org> on behalf of VPAC Ltd.

adfries (Alex Fraser) added a comment.Via Old WorldDec 23 2011, 1:41 AM

As discussed with Janne on IRC, the patch in its current form may not be ideal. It might be better to either:
- Combine this feature with the Point Density texture, or
- Combine it with the force field visualisation work by Lukas.

Attached is a new version of the patch that applies against r46643 (fluidDensity_r46643_4_svn.patch). This version no longer introduces a new texture type: instead, the new functionality is added directly to Point Density. A new test file is attached, and new rendered image.

Point Density now has three modes: [Particle System, Object Vertices, Fluid Particles]. In Fluid particles mode, all the falloff options are disabled, because this information is taken from the SPH settings. Also the colour source is hidden, because extracting the velocity and age is not implemented yet (it would be possible, in future, to extract these using the SPH kernel).

The attached image (fluidVsPoint_wave2.png) shows the difference between the old Particle System mode and the new Fluid Particles mode. Blue is old, red is new. As shown in the image, it is possible to come close with the old method, but it is not an accurate representation of the SPH density field.

adfries (Alex Fraser) added a comment.Via Old WorldMay 16 2012, 8:44 AM

Attached a new version (fluidDensity_r46643_5_svn.patch) which fixes a crasher: now, if Fluid Particle mode is chosen but the particle system has no fluid settings, the texture will return a value of zero for all samples. Note that the old Particle System mode is unaffected by this.

With a volumetric material, this can also be used to render a surface of a particle fluid (fluidDens_volume.jpg). Although, you can get similar results with the original Point Density texture - but this is more accurate! :)

Attaching a new version of the patch (fluidDensity_r53102_6_svn.patch) that applies against HEAD. This version works with the new classical SPH solver too.

Also attaching a comparison of the SPH density field vs regular point density texture for a dam break simulation (fluidVsPoint_dam_break.png).

zeauro (ronan ducluzeau) added a comment.Via Old WorldDec 19 2012, 5:08 PM

I am trying your patch.
I am frustated to not having access to radius and fall-off settings.
Although shape's accuracy is better; it is difficult to obtain a rendered volume close to what we see in 3D view.
It is obvious in your render ( fluidDens_volume.jpg ). Borders of rendered volume are far away from borders of particles mass in 3D view.
I hope that efforts to create low-poly surface for sph will happen.
Volumes are slow to render and a nightmare in compositing (no ability to obtain correct normals for reflection rendering, no only shadow option, no raytransparency limited to point density).

zeauro (ronan ducluzeau) added a comment.Via Old WorldDec 21 2012, 1:16 AM

image upload

zeauro (ronan ducluzeau) added a comment.Via Old WorldDec 21 2012, 1:25 AM

a blend to show problem with a volume.
http://www.pasteall.org/blend/18286

a pratical case where i did not succeed to obtain a thin fluid with fluid particles choïce.
http://www.pasteall.org/blend/18287

zeauro (ronan ducluzeau) added a comment.Via Old WorldJan 5 2013, 5:45 PM

I made an animation with this patch.
http://vimeo.com/56813254

adfries (Alex Fraser) added a comment.Via Old WorldJan 14 2013, 11:40 PM

Hi Ronan,

Sorry it has taken me so long to respond. The animation is good! Are you happy with that result, or do you still want more control over the look?

How useful do you think this texture is in general? If there was a way to generate a surface mesh from the particles, would you use the texture at all?

Cheers,
Alex

Add Comment