Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Transparent seam between fluids
#1
Hi,

I have 2 different emitters emitting the same kind of fluid: same blueprint, size, etc. Only the color is changed for clarity.
When the 2 fluids come in contact with each others, a visible transparent seam will appear between them.

I am on URP.

Here attached, you can see the seam and the Obi Fluid Renderer settings.

As shown in one screenshot, turning off Particle Z Write removes the seam, but the particles become very blob-ish where they contact each others (from different emitters) and one emitter fluid seems to prevail over the other, giving a wrong impression of what the actual fluid composition should be (looks like 80% blue, instead of the 50% blue and 50% red)

Any idea how to fix this? Changing the color blending (Obi Fluid Renderer) doesn't seem to help, but I don't understand yet what I'm doing there anyway.


Attached Files Thumbnail(s)
       
Reply
#2
(23-01-2023, 10:28 AM)Voolg Wrote: Hi,

I have 2 different emitters emitting the same kind of fluid: same blueprint, size, etc. Only the color is changed for clarity.
When the 2 fluids come in contact with each others, a visible transparent seam will appear between them.

I am on URP.

Here attached, you can see the seam and the Obi Fluid Renderer settings.

As shown in one screenshot, turning off Particle Z Write removes the seam, but the particles become very blob-ish where they contact each others (from different emitters) and one emitter fluid seems to prevail over the other, giving a wrong impression of what the actual fluid composition should be (looks like 80% blue, instead of the 50% blue and 50% red)

Any idea how to fix this? Changing the color blending (Obi Fluid Renderer) doesn't seem to help, but I don't understand yet what I'm doing there anyway.

Hi there!,

Particle Z Write should be disabled by default: this will prevent other fluid particles from merging with the ones already in the screen by writing to the buffer which is required for some opaque fluid effects, but for the majority of transparent fluid it should be off.

(23-01-2023, 10:28 AM)Voolg Wrote: Any idea how to fix this? Changing the color blending (Obi Fluid Renderer) doesn't seem to help, but I don't understand yet what I'm doing there anyway.

Depending on the colors you're using, and your color blending mode, results will be different. For instance if you're using the default blending which is multiplicative blending, and red / blue as your fluid colors, it will result in black areas where both meet (since red (1,0,0)  x blue (0,1,0) = (0,0,0)).

Right now you seem to be using alpha blending (src_alpha and one_minus_src_alpha as blend factors for both particles and fluid), which will make sure whatever particles are rendered last have preference over those that are "behind" them, using their density as the alpha value.

(23-01-2023, 10:28 AM)Voolg Wrote: Changing the color blending (Obi Fluid Renderer) doesn't seem to help, but I don't understand yet what I'm doing there anyway.

Color blending is a very basic concept in graphics. These options determine how the color of objects being rendered to the screen are blended with other objects already in the screen, in the following link you'll find a comprehensive list of all available color blending operators/factors in Unity:
https://docs.unity3d.com/2018.4/Document...Blend.html

These also exist outside of Unity and can be found in most other graphics-related software (blender, photoshop) as well as graphics APIs, albeit with slightly different names:
https://www.elegantthemes.com/blog/desig...ding-modes
https://www.informit.com/articles/articl...6&seqNum=5

A more technical introduction:
https://www.cs.csustan.edu/~rsc/SDSU/Color.Blending.pdf

I'd suggest studying how color blending works, as the amount of different effects that can be achieved by combining multiple blending factors and operators is too large to list individually.

kind regards,
Reply
#3
Thank you for the answer and the links, I'll try to understand those a bit better.
Reply