Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How can I get fluid material from custom meshes (melting effect)
#1
Hi, as I understand the fluid rendering works this way, you render the impostors and blur them in screen space and calculate the normals of the surface and render it, 
but can I put my other objects in that pipeline and get the same fluid effect?

See the video: https://drive.google.com/open?id=1sMH2Vv...bkv8LIH_HG

I want to make a fluid from this cubes (get some melting effect). I think it should be a way to feed this cubes to the renderer instead of the impostors, the only difference seems to be the performance, but I'm not going to use a lot of cubes so it should be ok, how can I do that?

For melting effect, the easiest thing that comes to my mind is to disable the cubes and emit particles in their positions, but they will not have the shape of the cube and I can't emit them like I do with the unity's particle system, where if I wanted to convert the cubes to particles I would just loop through the cubes, set the particle sys. position to the cube's pos and call ParticleSystem.Emit(count), but the only way to control the ObiEmitter is to change the speed value. And also I can't use mesh emmiter because I need to have the ability to melt down the half of the objects and don't touch the other part.

It would be awesome to be able to feed any type of mesh to the fluid renderer, it will solve a lot of problems for the future too.

Thanks.
Reply
#2
Hi!

Not something we plan on doing anytime soon, as the renderer is specifically designed to render particles, and takes advantage of many assumptions that only hold true for particles. Using arbitrary meshes instead isn't as simple it sounds, there's several issues that complicate it:

The renderer assumes all particle geometry is collapsed into a single mesh composed of collapsed quads: a sort of point cloud. These points are then expanded  into camera-facing billboards in the vertex shader. This is for efficiency, as it allows to render thousands of particles without the need for GPU instancing, compute/geometry shaders, etc. Using arbitrary individual meshes would force the use of instancing, and a big part of the renderer and the shaders used for it would have to be modified/rewritten.

Also, a big part of how the fluid looks is transmission/absorption. This is calculated taking into account the thickness of each individual particle as seen from the camera's pov. Then, the individual thickness of each particle is rendered additively on the thickness buffer, and used to make the fluid appear darker in zones where it is thicker. Without absorption all you're left with is a plain opaque/refractive surface.

For ellipsoidal/spherical particles, thickness can be calculated analytically. For an arbitrary mesh however, it can't. You'd have to do it in two passes, rendering the depth of back faces of all objects with a "max" blending mode, then the front faces with a "min" blending mode, and subtracting both. This is significantly more complex that the approach used for particles.
Reply