We will be out of office from December 23th to January 7th. During this time we'll check the forums less often, we'll be back at full throttle soon. Take care, Merry Christmas!
Hello there,
Im making a drink mixing game, and I didn't completely understand how the coloring of the fluids work. using the example from http://obi.virtualmethodstudio.com/manua...usion.html when i pour both the colors into a bowl, the end result is red
Both of my Fluid blueprints are from the link
If i can get some help, id greatly appreciate it.
Thanks
28-03-2022, 12:15 PM (This post was last modified: 28-03-2022, 12:16 PM by josemendez.)
(28-03-2022, 12:00 PM)canaydiin Wrote: Hello there,
Im making a drink mixing game, and I didn't completely understand how the coloring of the fluids work. using the example from http://obi.virtualmethodstudio.com/manua...usion.html when i pour both the colors into a bowl, the end result is red
Both of my Fluid blueprints are from the link
If i can get some help, id greatly appreciate it.
Thanks
Hi!
Maybe your fluid renderer's absorption is too high, making orange-ish colors in a thick fluid appear completely red.
Check the actual color of the particles (by enabling the ObiParticleRenderer's component "render" checkbox). If the color looks correct, reducing rendering absorption or making the fluid opaque are possible solutions. See:
Maybe your fluid renderer's absorption is too high, making orange-ish colors in a thick fluid appear completely red.
Check the actual color of the particles (by enabling the ObiParticleRenderer's component "render" checkbox). If the color looks correct, reducing rendering absorption or making the fluid opaque are possible solutions. See:
28-03-2022, 02:49 PM (This post was last modified: 28-03-2022, 02:50 PM by josemendez.)
(28-03-2022, 01:14 PM)canaydiin Wrote: Hi there,
When i enable the render checkbox, it seems a lot weirder..
You must disable the fluid renderer component too, otherwise you will be rendering both the fluid surface and the particles which will of course look weird. See:
Quote:Disable the ObiParticleRenderer's "render" checkbox if you want only the fluid surface drawn by the Fluid Renderer to be visible. If you don't, both the fluid surface and the individual particles will be rendered.
(28-03-2022, 02:49 PM)josemendez Wrote: You must disable the fluid renderer component too, otherwise you will be rendering both the fluid surface and the particles which will of course look weird. See:
29-03-2022, 07:31 AM (This post was last modified: 29-03-2022, 02:31 PM by josemendez.)
(28-03-2022, 10:20 PM)canaydiin Wrote: Im sorry for late reply, for some reason I couldn't reply back..
I was able to get the color mix i wanted kinda, however the fluid looks more like a solid instead of liquid..
Hi,
You set transparency very low (26%) so the fluid is mostly opaque (solid). If you want a transparent liquid, transparency should be at maximum.
Your particle blend source/dest are set to Dst alpha, and to One Minus Dst Alpha. This is rather weird as it will only use your framebuffer's alpha channel for blending, which is definitely not what you want.
If you want alpha blending instead of the default multiplicative blending, use Src Alpha and One Minus Src Alpha for both particle and blend source/destination respectively. This will give you good results:
You set transparency very low (26%) so the fluid is mostly opaque (solid). If you want a transparent liquid, transparency should be at maximum.
Your particle blend source/dest are set is set to Dst alpha, and to One Minus Dst Alpha. This is rather weird as it will only use your framebuffer's alpha channel for blending, which is definitely not what you want.
If you want alpha blending instead of the default multiplicative blending, use Src Alpha and One Minus Src Alpha for both particle and blend source/destination respectively. This will give you good results:
I got to ask, why isn't there a proper fluid mixing scene which is 3D? I appreciate your answers, however using the options that you've listed, it seems that my yellow liquid turned dark blue and my red liquid has turned turquoise kind of color. I am using the values from your Diffusion manual, yet for some reason I cannot get the same result.
I really wish there was more documentation for this.
29-03-2022, 02:18 PM (This post was last modified: 29-03-2022, 02:39 PM by josemendez.)
(29-03-2022, 01:48 PM)canaydiin Wrote: I got to ask, why isn't there a proper fluid mixing scene which is 3D?
Because in 3D color mixing is much harder to appreciate. As light travels trough fluids, it gets absorbed by them which means you won't be able to see much going on inside of a thick fluid volume. This being said, 2D can be switched to 3D by simply changing the solver's 2D/3D mode.
Also, because each sample scene tries to showcase one specific use case in the purest/clearest way. There’s no scenes that feature adhesion & rolling contacts, or advection & color mixing, or viscosity in 2D either. If I had to create one sample scene for each possible combination of features there would be thousands!
(29-03-2022, 01:48 PM)canaydiin Wrote: I appreciate your answers, however using the options that you've listed, it seems that my yellow liquid turned dark blue and my red liquid has turned turquoise kind of color. I am using the values from your Diffusion manual, yet for some reason I cannot get the same result.
That's really strange. Blue (0,0,1) is the exact inverse of bright yellow (1,1,0), and red (1,0,0) is the exact inverse of turquoise (0,1,1). This cannot be a coincidence:
there must be something in your setup inverting the colors, my guess would be either incorrect blending modes or incorrect passing of diffusion data to particle colors.
How are you writing the diffusion user data back into the particle's color channels? I used the sample code in the manual:
Code:
void LateUpdate()
{
for (int i = 0; i < solver.userData.count; ++i)
solver.colors[i] = solver.userData[i];
}
These are the results I get (red+yellow = orange):
(29-03-2022, 01:48 PM)canaydiin Wrote: I really wish there was more documentation for this.
What exactly are you missing or wish to see explained more in-depth? Documentation regarding rendering and diffusion is very detailed imho, each parameter is explained and there's usually screenshot comparisons of different values. It also includes code samples for typical use cases.
(29-03-2022, 02:18 PM)josemendez Wrote: Because in 3D color mixing is much harder to appreciate. As light travels trough fluids, it gets absorbed by them which means you won't be able to see much going on inside of a thick fluid volume. This being said, 2D can be switched to 3D by simply changing the solver's 2D/3D mode.
Also, because each sample scene tries to showcase one specific use case in the purest/clearest way. There’s no scenes that feature adhesion & rolling contacts, or advection & color mixing, or viscosity in 2D either. If I had to create one sample scene for each possible combination of features there would be thousands!
That's really strange. Blue (0,0,1) is the exact inverse of bright yellow (1,1,0), and red (1,0,0) is the exact inverse of turquoise (0,1,1). This cannot be a coincidence:
there must be something in your setup inverting the colors, my guess would be either incorrect blending modes or incorrect passing of diffusion data to particle colors.
How are you writing the diffusion user data back into the particle's color channels? I used the sample code in the manual:
Code:
void LateUpdate()
{
for (int i = 0; i < solver.userData.count; ++i)
solver.colors[i] = solver.userData[i];
}
These are the results I get (red+yellow = orange):
What exactly are you missing or wish to see explained more in-depth? Documentation regarding rendering and diffusion is very detailed imho, each parameter is explained and there's usually screenshot comparisons of different values. It also includes code samples for typical use cases.
Well I guess I've should have said more examples as well then.. But also more information about the diffusion data, and some examples of it of doing different things maybe, as you said, it is explained in details and I could probably do the other features but i cannot duplicate the mixing part. Because I've even copied the example you guys have and I can't seem to get the same result. I have also used the same code from the manual. The only thing that I've put which is extra is the speed changing so I can pour liquid when I press a button.
29-03-2022, 02:59 PM (This post was last modified: 29-03-2022, 03:07 PM by josemendez.)
(29-03-2022, 02:53 PM)canaydiin Wrote: Well I guess I've should have said more examples as well then.. But also more information about the diffusion data, and some examples of it of doing different things maybe, as you said, it is explained in details and I could probably do the other features but i cannot duplicate the mixing part. Because I've even copied the example you guys have and I can't seem to get the same result. I have also used the same code from the manual. The only thing that I've put which is extra is the speed changing so I can pour liquid when I press a button.
Would it be possible for you to share your project with me? Send it to support(at)virtualmethodstudio.com . This way I can take a closer look and hopefully be able to help you.
Diffusion is quite simple: each particle carries a Vector4 (the user data) and these get averaged together when particles go within the vicinity of each other. That’s all there is to it, that’s why I’m surprised it isn’t working correctly for you.
The screenshot in my previous post is from the “FluidMixing” sample scene. Changes to the original scene:
-switch the solver to 3D
-add a FluidRenderer to the camera, increase radius scale on the particle renderers and uncheck “render”.
-remove the components in the emitters that map diffusion data to a gradient and replace them with a simple color=userData script.
-set the user data to (1,0,0,1) and (1,1,0,1) in each fluid.
That should work, let me know how it goes. Anyway, if I can take a look at your project it would be great!