Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Mesh and Fluid Problem
#51
(27-12-2019, 02:33 PM)josemendez Wrote: Same reason as the previous question: pink * pink=purple (which is just darker pink, in zones with more particle density). Cyan * cyan = Cyan. Using numbers:

(0.5, 0, 0.5) * (0.5, 0, 0.5) = (0.25, 0, 0.25)
(0, 1, 1) * (0, 1, 1) = (0, 1, 1)

Again, use either additive blending or alpha blending.

Another question, how do we render fluids inside a transparent glass?

And in which particular script do you need to change these numbers? Thx
Reply
#52
(27-12-2019, 09:44 PM)sc00b Wrote: Another question, how do we render fluids inside a transparent glass?

I thought you needed 2D fluid? Do you mean how to render a transparent object over it?

(27-12-2019, 09:44 PM)sc00b Wrote: And in which particular script do you need to change these numbers? Thx

These were just examples of rgb values, to illustrate the color blending operations going on. You can’t change them anywhere, they were just examples.

What you need to change is the blend mode of your color shader (FluidColorsBlendSimple.shader, or whatever name you gave it) from multiplicative to additive. Here’s Unity’s reference page on blend modes:

https://docs.unity3d.com/Manual/SL-Blend.html
Reply
#53
(27-12-2019, 10:09 PM)josemendez Wrote: I thought you needed 2D fluid? Do you mean how to render a transparent object over it?


These were just examples of rgb values, to illustrate the color blending operations going on. You can’t change them anywhere, they were just examples.

What you need to change is the blend mode of your color shader (FluidColorsBlendSimple.shader, or whatever name you gave it) from multiplicative to additive. Here’s Unity’s reference page on blend modes:

https://docs.unity3d.com/Manual/SL-Blend.html

Obi Fluid Render - May https://www.dropbox.com/s/lgoqx9dpxawin9...7.png?dl=0
Reply
#54
(27-12-2019, 11:13 PM)sc00b Wrote: Obi Fluid Render - May https://www.dropbox.com/s/lgoqx9dpxawin9...7.png?dl=0

That’s not done during fluid rendering. That would be a transparent material that uses grabpass (or a similar method to capture what’s rendered before it) and a blur pass, to obtain a frosted glass effect.
Reply
#55
(27-12-2019, 11:19 PM)josemendez Wrote: That’s not done during fluid rendering. That would be a transparent material that uses grabpass (or a similar method to capture what’s rendered before it) and a blur pass, to obtain a frosted glass effect.

How do we achieve this result in our renderer?
Reply
#56
(27-12-2019, 11:28 PM)sc00b Wrote: How do we achieve this result in our renderer?

As I said that’s not done in the fluid renderer.

Its a “frosted glass” shader. They are generally done by grabbing the screen contents and blurring them using a gaussian blur. There are heaps of tutorials out there on how to do this, and probably ready-made assets in the store that implement it.
Reply
#57
(27-12-2019, 02:33 PM)josemendez Wrote: Same reason as the previous question: pink * pink=purple (which is just darker pink, in zones with more particle density). Cyan * cyan = Cyan. Using numbers:

(0.5, 0, 0.5) * (0.5, 0, 0.5) = (0.25, 0, 0.25)
(0, 1, 1) * (0, 1, 1) = (0, 1, 1)

Again, use either additive blending or alpha blending.

https://www.dropbox.com/s/2lsc8ig15a2d5i...2.png?dl=0 - how to make the average accepted when mixing pink and green? instead of black ...
Reply
#58
(28-12-2019, 07:46 PM)sc00b Wrote: https://www.dropbox.com/s/2lsc8ig15a2d5i...2.png?dl=0 - how to make the average accepted when mixing pink and green? instead of black ...

How have you set up the diffusion values for both fluid types? Black should only appear when the fluids have very little or no diffusion, and both colors multiply each other without mixing (because as I pointed out before multiple times, when using multiplicative blending pink*green = black, green*red = black, as they're complementary colors).

Chemical A and Chemical B in the FluidMixing scene both have a diffusion of 0.002, and the diffusion data channels for chemical B are (1,0,0,0). Then this channel is mapped to a particle color using the gradient in ObiFluidPropertyColorizer as diffusion kicks in. Make sure your setup mimics this one.
Reply
#59
(28-12-2019, 08:46 PM)josemendez Wrote: How have you set up the diffusion values for both fluid types? Black should only appear when the fluids have very little or no diffusion, and both colors multiply each other without mixing (because as I pointed out before multiple times, when using multiplicative blending pink*green = black, green*red = black, as they're complementary colors).

Chemical A and Chemical B in the FluidMixing scene both have a diffusion of 0.002, and the diffusion data channels for chemical B are (1,0,0,0). Then this channel is mapped to a particle color using the gradient in ObiFluidPropertyColorizer as diffusion kicks in. Make sure your setup mimics this one.

I understand how your system works, but in life it’s not. In the gradient picture, it is shown that if you mix 50 to 50, you get a grayish tint. Here's how to get it? Change the script, but which one?

p.s. Yellow with red, it turns orange, but if you mix red and green you should get a different color, but definitely not black) understand?)
Reply
#60
(28-12-2019, 09:49 PM)sc00b Wrote: I understand how your system works, but in life it’s not. In the gradient picture, it is shown that if you mix 50 to 50, you get a grayish tint. Here's how to get it? Change the script, but which one?

p.s. Yellow with red, it turns orange, but if you mix red and green you should get a different color, but definitely not black) understand?)

Nope, I don’t understand. When using diffusion, the colors you get are the ones defined in the gradient (could not get a color that’s not in the gradient, as it is directly evaluated using interpolation). You don’t need to change any script for this to happen. Simply ensure your fluid materials have diffusion > 0 and one of them has non zero diffusion channels. This is what the fluid mixing sample scene does, try it.

When not using diffusion, if you mix red and green (using multiplicative blending) you can only get black. This is also how it works in real life: try mixing red ink and green ink, you’ll get black, as you’d get when mixing any complementary colors. (See https://www.google.es/amp/s/m.wikihow.co...ck%3famp=1). It is mathematically impossible to get anything but black when multiplying red and green, as I demonstrated earlier:

Red: (1,0,0)
Green: (0,1,0)
Red * Green: (1,0,0)*(0,1,0) = (0,0,0) = black.

If using additive blending, you’d get yellow instead (this is how light blends in real life). You can change the blending mode in FluidColorsBlendSimple.shader as I mentioned before. I also gave you a link to Unity’s reference page on blending modes, so honestly I don’t know what else to do.

This is getting extremely confusing for me, I no longer know if anything I said makes any sense to you. If you could share your project with me I think things would be easier for both of us. You can send it to support(@)virtualmethodstudio.com and I’ll take a look at it.
Reply