PDA

View Full Version : Water displacement in a bowl



Mr. Wilde
03-28-2014, 07:51 AM
Hi,

After seeing the water in ary3d's Frog Turntable (http://forums.newtek.com/showthread.php?140572-Frog-Turntable-rig-with-genoma), I've been playing with liquids in various containers by using a displacement map, as you can see in this thread:
http://forums.newtek.com/showthread.php?140805-Balls-in-a-pool&p=1374674#post1374674

I'm using a displacement texture on the Y axis, and an alpha gradient to stop it from affecting the bottom. This works for any shape that has vertical sides: cylinders, cubes, etc...

BUT how could I do this for other shapes, like for water in a bowl? How can I displace the top of the water object, but keep it well inside the glass bowl? Right now, I can't stop it from intersecting with the outside glass.

Thanks!
Rob

Chrusion
03-28-2014, 04:51 PM
Thinking out loud... is it possible to combine displacements with hardFX collision? That is, use the bowl as the collider for the water under the influence of displacements?

JoePoe
03-28-2014, 08:51 PM
How about..... thinking.... mmmm.... DP Boolean in the clipping channel??

JoePoe
03-29-2014, 07:23 AM
Seems to take a long time to render 8~, but that could just be my crappy machine..... or the booleans...... or both. :D

121078 121079

Mr. Wilde
03-29-2014, 08:05 AM
Thank you! That looks promising. Though it's pretty slow and not very stable, it seems.

How can I combine this with the dielectric node?

JoePoe
03-29-2014, 12:38 PM
I was a little concerned with dielectric myself considering how it likes closed meshes.
But it seems to have held up under the booleans.
The shader is used in the texture channel for Clipping in object properties render tab, so your surfaces are the same setup as usual EXCEPT that the "outside"/cutter object's texture for the Boolean needs to be double sided (and since you want the top of the fluid to match the body it's the same texture anyway....with just that one difference).

Maybe I should do a render with just flat closed fluid as a comparison.

Edit: well that was easy. Confirmed (at least anecdotally :D) on both points. Dielectrics seems to hold up AND holy cow does that Boolean shader slow render times!!
Almost to the point of being impractical....at least when rendering Dielectric surfaces.

121082

Yeah, even this silliness took way too long for what it's worth.
121083

I should have probably asked first...... is this for a still shot or animation?
For still, it's much more efficient to do your displacement (cutter) in layout, save transformed object and bring it back to Modeler for a Boolean there.
For animation..... mmmm.... :stumped:

spherical
03-29-2014, 09:56 PM
OK, I've read this four times and can't quite get it. Got a scene file, or a video, so I can see how you're doing this? Looks great.

Mr. Wilde
03-30-2014, 06:32 AM
There are several issues with this method, unfortunately. I can't get the clipping to work (I tried it with both the native Node Editor and DP's Node Texture (http://forums.newtek.com/showthread.php?119003-DP-Boolean-Question)), in either LW 11, 11.5 or 11.6.2. And if I use it on transparency, there is a ghost reflection of the whole water object on the glass bowl. And it's extremely slow and crashes a lot.

I've found this thread: http://forums.newtek.com/showthread.php?133312-Lightwave-11-5-Water-surface about water using cloth dynamics. Maybe, as Chrusion already suggested, there's a way to do it with dynamics.

dpont
03-30-2014, 07:21 AM
There are several issues with this method, unfortunately. I can't get the clipping to work (I tried it with both the native Node Editor and DP's Node Texture (http://forums.newtek.com/showthread.php?119003-DP-Boolean-Question)), in either LW 11, 11.5 or 11.6.2...

Speaking of Boolean node for climapping,
I don't think it is compatible with native Texture node editor,
and about crashing, there's an issue with Node Texture for clipmap
with last versions of Layout, but not crashing in the plugin itself
so no way for me for debugging,

Slowness of Boolean node has always to do
with the number of polygons.

Denis.

lertola2
03-30-2014, 07:27 AM
This thread had a long discussion of this topic: http://forums.newtek.com/showthread.php?113273-Drinking-Liquid-from-a-glass/page2

In the thread I showed how to render animated clip maps which allows you to animate the shape of the liquid surface and the container separately. That method is tedious to set up but if you dont find another way it could be a practical way to get animated liquid in a round container.

Mr. Wilde
03-30-2014, 10:55 AM
Thanks a lot!

In that thread, you posted an image of the UV maps that gave you an error.
http://forums.newtek.com/attachment.php?attachmentid=89172&d=1287536047

What did the UV map look like in the final version that gave you no errors?

XswampyX
03-30-2014, 02:29 PM
Thought I'd chip in....

Have you thought about using the ray cast displacement node to 'grow' your water into the bowl?
Just place a displaced plane over the opening of the bowl and you can even get animated ripples.

http://i465.photobucket.com/albums/rr16/xXswampyXx/Ray_Cast_Water_zpsb8e01127.gif (http://s465.photobucket.com/user/xXswampyXx/media/Ray_Cast_Water_zpsb8e01127.gif.html)

It will crash LW sometimes.....

JoePoe
03-30-2014, 02:49 PM
Haven't sunk my teeth into Lertola2's thread just yet... Will do.

But the question was asked.... and for anyone else who is still curious about DP Booleans.... scene files attached.
Simple setup without dielectric or displacement. (Well, I couldn't resist a little AO. :hey:)
Look at the "T" for clipping for both objects.
Make note:
That the texture level is 100% for both.
Double click on the Boolean nodes to see that they reference each other and which object is "inside" and which is "outside".
That the surface for the cutter object (green) is double sided.

Re: slow down. Sure, I get it. Poly count..... counts :D.
However, the same Boolean in Modeler took a minute or so, but in Layout whatever processes were going on added several hours to the render time (...in fish bowl images above).

image from attached: 121093

JoePoe
03-30-2014, 03:25 PM
Swampy.... didn't see you there.
That looks like the ticket!! Having trouble getting to the bigger image on Photobucket.... probably just a temp glitch.

XswampyX
03-30-2014, 03:43 PM
Swampy.... didn't see you there.
That looks like the ticket!! Having trouble getting to the bigger image on Photobucket.... probably just a temp glitch.

Hello!

121097

Here it is, but bigger.

Mr. Wilde
03-30-2014, 07:35 PM
Wow that's amazing! Thank you, I'm going to try that as soon as possible. In addition, I could use this to put objects on the water suface and have them not intersect it, but truly displace it.


Since I don't have any fundamental understanding how LightWave works under the hood, I'm wondering if there could be any sequence issues (maybe a reason for a crash). You have a displacement texture on the plane, and a displacement texture on the water body using raycast. But which object displacement is calculated first?

lertola2
03-30-2014, 08:12 PM
Thanks a lot!

In that thread, you posted an image of the UV maps that gave you an error.
http://forums.newtek.com/attachment.php?attachmentid=89172&d=1287536047

What did the UV map look like in the final version that gave you no errors?

I recall that in the end I was able to create animated clip maps and apply them properly to the scene. I don't remember why there was an error in the uv map I posted but I do remember that I found out what the problem was and fixed it. I think that clip map method is reliable but it is tedious to set up. The advantage is that once it is setup the render times should be good. If you are interested I could put together an example scene explaining the method. But I would be interested in finding out if XswampyX's ray cast method is a practical way to get this kind of effect.

spherical
03-31-2014, 01:47 AM
Hello!
Here it is, but bigger.

Ok, that looks better but which Input node output goes to which Ray Cast Geometry node input? With the placement of the nodes, their splines are on top of each other.

lertola2
03-31-2014, 05:12 AM
Hello!

121097

Here it is, but bigger.

Why do you need the Logic node?

XswampyX
03-31-2014, 05:40 AM
I put it there just to make sure it didn't pass a zero/negative value to the scale node. It was an attempt at curing the odd crash I was having.

XswampyX
03-31-2014, 05:42 AM
Ok, that looks better but which Input node output goes to which Ray Cast Geometry node input? With the placement of the nodes, their splines are on top of each other.

I can't remember. but one vector is a direction and the other is position, so it should be quite obvious.

Mr. Wilde
03-31-2014, 07:55 AM
I put it there just to make sure it didn't pass a zero/negative value to the scale node. It was an attempt at curing the odd crash I was having.

So the Logic node is "If A less than B"? What value do you subtract from A then?


*edit*
I found that it is pretty unstable with subpatched objects.
And for some reason it doesn't work at all with geometry created in Layout (Planes, Spheres, Cubes, etc...).
Also some test scenes I did simply don't open anymore, LightWave crashes instantly. Even though they didn't crash when I worked on them.

XswampyX
03-31-2014, 10:50 AM
Yep, It is kinda unstable. It can freeze at any ......

.....time. :D

XswampyX
03-31-2014, 01:38 PM
You can bake out the deformation and then render it just as any cloth simulation.


http://youtu.be/QZBh6hE3m8s

Mr. Wilde
03-31-2014, 01:45 PM
That's awesome.

But I'm still having trouble getting it to work in the first place. It's all jaggy, sometimes there are spikes shooting out of it that are 100 miles long.

XswampyX
03-31-2014, 02:17 PM
I would try getting it to work without subpatch.
Then turn on subpatch, but set it to last.
Also use the model that you first posted as the container, copy it into a new layer, scale it down by 10% and then use that for your fluid.
When it looks good, you can bake it out and transfer it to your main scene.
When you save your scene, turn off the deform node on the fluid layer, and then at least it will load in next time.
I might post a scene, but I was hoping somebody would get it to work and iron out some of the crashes I am getting. :D

Mr. Wilde
03-31-2014, 04:13 PM
Thanks for the hints!

CC subpatches make it misbehave and crash a lot more often than normal subpatches.

And it seems to misbehave when the water body and the bowl container aren't centered at the origin in modeler? Changing the pivot point does not change that. Can that be the case? If so, why?

The displacement plane needs to be set to "Before Local Displacement" while the water body needs to be set to "Before World Displacement", otherwise there are more crashes.

XswampyX
03-31-2014, 05:04 PM
Hmmmm...

I don't ever use CC, it's too slow and makes you lazy when you are modelling.
I wouldn't ever do a simulation off the origin, it adds too many variables that can mess it up. If you can make it simple, then why not?
I've redone the scene from scratch, taking into account what I learnt from making the first one..... have a look.

121106

You need to enable the node displacement on the second layer/fluid layer. Oh, and turn on VPR. It's soooooo fast!

This is really meant for baking the motion out and then transferring it over to your actual scene.

Let me know how you get on, it's been very interesting so far. :D

Mr. Wilde
04-01-2014, 08:15 AM
Thank you!

I tried to get the edge of the water to get as sharp as possible. But the denser the mesh gets, the more issues arise. For one thing, it crashes more often. And then I'm getting spikes that suddenly shoot out of the mesh. I think it has to do with mesh density. The denser the mesh, the more errors are produced by the ray cast.

Does the ray cast node have any relation to Ray Precision, Shading Samples, etc...? What determines the accuracy of the rays that are being cast?

XswampyX
04-01-2014, 11:42 AM
I think the Ray precision is set. But you can add a small offset vector to the ray origin input of the raycast node... x=0.0001 y=0.0001 z=0.0001 and that seems to fix them. It might cause others to pop into existence though... Or you could just past the ray origin vector through a turbulence texture with bump set to 0.001 and hope that the resolution and the bump texture don't align to create the error.

Does that even make sense? :D