Jump to content

Fluid Color mix


Luismarmay

Recommended Posts

Hi,

I've been doing some R&D on mixing multiple fluids with different colors and densities. The most common approach, as far as I know, is using a SOP Solver to transfer Cd between particles, allowing the colors to blend. However, I'm concerned about how this will look in the render.

Once the particle simulation is meshed, it becomes a closed surface, which might prevent the internal color mixing from being visible. This led me to consider alternative approaches, such as rendering the inside using a VDB. I'm not entirely sure about that part yet.

Because of this, I decided to try mixing colors using microsolvers instead of relying on a SOP Solver with attribute transfer, aiming to generate a color field. My approach consists of:

  1. Gas Match Field – Creating a new field (color) based on vel.
  2. Gas Particle to Field – Transferring the Cd attribute from the particles to the new color field.
  3. Gas Diffuse – Attempting to blend the colors within the field.
  4. Gas Field to Particle – Transferring the blended field back to the particles.

This method seems to work, but I noticed that the actual mixing is happening due to Gas Field to Particle, which interpolates Cd every frame. While this gives me a decent result, the Gas Diffuse node doesn't seem to have any effect, and I have limited control over the blending process.

At this point, I'm stuck. Any ideas or suggestions on how to improve this approach?

Thanks!

Here's the file if someone wants to check it out, thanks!

TestColorMix.hip

  • Like 1
Link to comment
Share on other sites

Nice approach!

Here are my constructive notes:

  • Using volume transfer for color can be computationally expensive because the color field in a volume requires three scalar fields
  • A gas microsolvers does not compute in VDB format, which is sparse and can save both storage and memory.
  • The Particle Cd attribute is a more efficient alternative to a three-scalar volume field for color. Consider enabling profiling to evaluate the performance and resource usage of your current setup
Link to comment
Share on other sites

  • 2 weeks later...
On 3/19/2025 at 5:52 AM, paranoidx said:

Nice approach!

Here are my constructive notes:

  • Using volume transfer for color can be computationally expensive because the color field in a volume requires three scalar fields
  • A gas microsolvers does not compute in VDB format, which is sparse and can save both storage and memory.
  • The Particle Cd attribute is a more efficient alternative to a three-scalar volume field for color. Consider enabling profiling to evaluate the performance and resource usage of your current setup

Thanks! ill check out your notes, normally i would work with particle Cd attribute but i was worried that i wasnt the best approach if i wanted to see that mixing inside the fluid, not only over the surface so i thougt that maybe doing the process with volumes would allowed me later to obtaint a volume field that i could render but after some research, i think i might need a differetn sim witch pyro to "emulate" that effect...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...