30-03-2022, 08:22 AM
(30-03-2022, 08:13 AM)josemendez Wrote: The project works fine for me, fluids get mixed and the resulting color is orange. You can verify this by disabling the fluid renderer and enabling the "render" checkbox on the emitters. This is how it looks when fluids have been just poured:
However re-enabling fluid rendering and disabling particle rendering, the orange fluid its way too red-ish. As I mentioned in my previous posts, this is due to incorrect blending and high absorption:
A) You're using multiplicative particle blending: "Dst Color" as blend source, and "Zero" as blend destination. So the blending equation for your particles becomes this:
Final Color = DstColor * sourceValue + Zero * destinationValue
(see: https://docs.unity3d.com/Manual/SL-Blend.html)
Which means each time a particle is rendered, its color (sourceValue) gets multiplied by that of the particles behind it (DstColor). Note that the destinationRGB gets multiplied by zero so it doesn't contribute.
So if your particles are orange (1,0.5,0), every time a new particle gets drawn this color gets multiplied by itself due to blending:
(1,0.5,0)*(1,0.5,0) = (1,0.25,0),
(1,0.25,0)*(1,0.5,0) = (1,0.125,0),
(1,0.125,0)*(1,0.5,0) = (1,0.0625,0)
.... etc, eventually reaching (1,0,0) which is pure red.
Using alpha blending instead (source:Src Alpha, dest:One Minus Src Alpha) respects the original color, instead of darkening it.
Blending is a basic concept in graphics, the blending equation (and blending factors / operators) are not explained in Obi's manual because they're covered by Unity's manual and many other online resources. Blending is extensively used in literally all rendering systems / game engines so it's something you should definitely get familiar with.
B) way too much absorption. Absorption darkens the fluid color (the output of the blending equation above) according to its "thickness". The deeper the fluid is, the longer light travels trough it and the less light reaches your eye. This is calculated using Beer's law, which results in exponential light decay. Reducing the absorption parameter from 5 to 1.2 will give better results.
Wrapping up: set your FluidRenderer's particle blend source/dest to SrcAlpha and One Minus Src Alpha respectively, and lower its absorption parameter to 1.2-1.5. This is the result:
Thanks for explaining, so to just to clarify, i have made the Particle Blend Source - SRC ALPHA and the Particle Blend Destination to - One Minus Src Alpha
What do i make the blend source and blend destination?