28-03-2018, 12:14 PM
(This post was last modified: 28-03-2018, 12:17 PM by josemendez.)
(28-03-2018, 07:04 AM)Caldor Wrote: I am trying to make a water gun in Unity for VR. I have managed to make a gun that has an emitter on its barrel. But I have some trouble controlling when it is supposed to be emitting, and when it is supposed to stop. I also tried using two solvers, but I am guessing that is best not to do, it seems extremely demanding for the CPU.
So now I am just using one solver for both my emitters. But I seem to have several problems, the first one being able to control when to emit as I mentioned, but also it does not seem easy to control how this fluid should look. I can change its color, but it always seems to be simple colors without any shaders or they just end up invisible. The faucet water is nice and transparent and such, looking a lot more like fluid, but even though I copied everything it still ends up seeming like its lacking a shader. Am I missing something? I tried different types of fluid. Simple fluid, low res... etc. Not sure if any of those are connected with a shader. I am guessing it has more to do with how the physics of the water behaves or something like that.
I have tried controlling it by setting the emitters speed to 0 if there is a certain amount of particles on the solver or on the emitter, but that also seems to cause problems.
Hi there,
I think you're confusing the emitter material (http://obi.virtualmethodstudio.com/tutor...rials.html) with the fluid rendering material (http://obi.virtualmethodstudio.com/tutor...ering.html). The first one dictates physical properties of the fluid, the second one influcences how it looks. None of the parameters in the emitter material influence rendering in any way, they only influence the physics.
ObiFluidRenderer will use the materias you specify in its inspector. There's two materials involved in rendering fluid: the color blending material, and the fluid material.
Make sure you are using a material with the dielectric fluid shader as the "Fluid material", and the fluid colors blend shader for the "Color material", just like in the viscosity, mill, and faucet examples.
Then, you can control fluid smoothness, cloudiness, refraction, thickness, etc in the material itself.
Regarding emission: set the emitter's speed to 0 to stop emitting, set it back to any value you wish to resume emitting. As in any real-world faucet, the emission speed and the volume emitted per second are linked to ensure a continuous stream, with minimum fluctuations in pressure.