Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  In SolidifyOnContact exsample, Diffusion and Normal of solidified fluid become weird
#1
Excuse me again.
In the SolidifyOnContact example, when I used a fluid with Diffusion and Normal textures, the result was as follows.

Liquid is correct diffusion and normal.
   

Solid is weird diffusion and normal texture.
   

Inspector used for ObiFluidSurfaceMesher
   

It seems that something is wrong because the invMass of the solidified particles becomes 0, but I couldn't figure it out even after looking at the shader graph.
Reply
#2
(01-08-2025, 12:30 PM)asimofu_ok Wrote: Excuse me again.
In the SolidifyOnContact example, when I used a fluid with Diffusion and Normal textures, the result was as follows.

Liquid is correct diffusion and normal.


Solid is weird diffusion and normal texture.


Inspector used for ObiFluidSurfaceMesher

Hi,

Diffuse and normal textures are advected trough the fluid's velocity field. Granulars (which is what fluid particles become upon impact with a surface and solidify) don't define a velocity field so they don't support diffuse/normal textures. We may extend the method in the future to generate a velocity field for granulars.

(01-08-2025, 12:30 PM)asimofu_ok Wrote: It seems that something is wrong because the invMass of the solidified particles becomes 0, but I couldn't figure it out even after looking at the shader graph.

This is intentional. As explained in the manual, setting the inverseMass of a particle to zero disables dynamics simulation for it and allows to override its position manually. This is what the sample scene does to "solidify" particles: turn them into granular particles with infinite mass (invMass = 0) and then set their position manually to follow the transform of the object they hit.

See Obi/Samples/Fluid/SampleResources/Scripts/SolidifyOnContact.cs script for more details.

kind regards
Reply
#3
(01-08-2025, 02:09 PM)josemendez Wrote: Hi,

Diffuse and normal textures are advected trough the fluid's velocity field. Granulars (which is what fluid particles become upon impact with a surface and solidify) don't define a velocity field so they don't support diffuse/normal textures. We may extend the method in the future to generate a velocity field for granulars.


This is intentional. As explained in the manual, setting the inverseMass of a particle to zero disables dynamics simulation for it and allows to override its position manually. This is what the sample scene does to "solidify" particles: turn them into granular particles with infinite mass (invMass = 0) and then set their position manually to follow the transform of the object they hit.

See Obi/Samples/Fluid/SampleResources/Scripts/SolidifyOnContact.cs script for more details.

kind regards
I see, thank you.
Reply
#4
Sorry to bother you again.
Is there a way to apply the velocity field to a solidified liquid using a script?
Due to my lack of knowledge about bursts, I was unable to determine what causes the velocity field.

UV seems to be generated from FlowmapAdvect in the shader graph, but the velocity there does not seem to be related to the velocity field.
Reply
#5
(04-08-2025, 03:11 AM)asimofu_ok Wrote: Sorry to bother you again.
Is there a way to apply the velocity field to a solidified liquid using a script?

Yes of course (you can do pretty much anything using a script) but it's not trivial.

The velocity field is calculated in BurstFluidMesherSystem.cs, in the SampleSDF job. There, we iterate over each "chunk" (group of 64 voxels) in the mesh, and for each vertex in the chunk, we iterate over nearby particles and calculate a weighted average of their velocity.

The problem again is that granular particles don't define a density value and don't have any neighborhood over which we can define a finite-support kernel. So for granulars, we'd have to fall back to a different method of calculating velocity field data.

(04-08-2025, 03:11 AM)asimofu_ok Wrote: UV seems to be generated from FlowmapAdvect in the shader graph, but the velocity there does not seem to be related to the velocity field.

Yes, the velocity there is calculated from the velocity value stored in each mesh vertex. These per-vertex velocities are the velocity field.

If this is an important use case for you I can take a deeper look and try to devise a way to calculate an appropriate velocity field for granulars, even if it's not perfect.

kind regards,
Reply
#6
(04-08-2025, 08:08 AM)josemendez Wrote: Yes of course (you can do pretty much anything using a script) but it's not trivial.

The velocity field is calculated in BurstFluidMesherSystem.cs, in the SampleSDF job. There, we iterate over each "chunk" (group of 64 voxels) in the mesh, and for each vertex in the chunk, we iterate over nearby particles and calculate a weighted average of their velocity.

The problem again is that granular particles don't define a density value and don't have any neighborhood over which we can define a finite-support kernel. So for granulars, we'd have to fall back to a different method of calculating velocity field data.


Yes, the velocity there is calculated from the velocity value stored in each mesh vertex. These per-vertex velocities are the velocity field.

If this is an important use case for you I can take a deeper look and try to devise a way to calculate an appropriate velocity field for granulars, even if it's not perfect.

kind regards,
Thank you very much for your detailed explanation.

I tried verifying the script for a while, but it seems very difficult to understand, so I think I'll give up for now.
Reply