Hello again!
I was looking at trying to create an interesting effect for this object:
My original intention was to create something with Cascade like a typical electric or energy effect (still might do so), but I got to thinking how I'd want to make something a little more challenging, and got the idea for seeing if there's a way in UDK to get a look where this tank is filled with a liquid with motion (bubbles, surface motion like boiling water). Best reference example I could think of would be an Erlenmeyer flask (though if it was boiling):
So I was wondering if anyone had any ideas or tutorials that would give me a hint as to how I'd set up such a material and implement it inside the glass container, if such a thing is possible.
Thanks!
Replies
Found a video:
http://www.youtube.com/watch?v=Wdvo6y0XF1c&feature=player_detailpage#t=350s
You could probably open that asset up in source and see how they've built it.
I also do not have access to Source at the moment.
Also, does it have thickness or is a single plane? Pending on how you set it up, there many solutions, so just fill in my questionnaire and I'll see what's possible in my lab.
I'm certainly open to solutions of any kind and am more than willing to change what is there (making a new geo or changing the UV's) to make it work.
Thank you!
Also, I'm going for the most expensive solution, but hopefully you can come up with your cheaper solution since the basic idea applies.
Change material type to Translucent.
Take a TexCoord node and Mask out whichever direction your want the gradient to fade out (R or G) pending on your UV's. Multiply a Constant by it, Power it, and Clamp at it end.
With the Mul you will dictate the 'amount' of liquid you want, with the Power the hardness near the end top and the Clamp will make sure it all doesn't glow like a radioactive waste.
Mul all this by a color of your choice.
Now here is the tricky part, put up a Lerp and insert the Fresnel in the Alpha, you're going to have to do this for pretty much all the other parts, basically your inner 'fluid' vs. the outer 'thickness' of the tube.
On the other hand, if you don't want this (you want complete fluid) then for the color it won't need a fresnel.
In the distortion slot however, keep the Lerp/Fresnel build, put a constant of either 1 or 0 zero for the interior, but for the edges, Multiply a Fresnel node by a Reflection, set the Fresnel value for the latter to something really low, like 0.5, etc.
As for the top, part, I'm honestly temped to just say stick in a flat plane and mask it with the effect, but there would be other issues there.
You could try and mask only a little part at the top, and bump offset the effect, add fresnel, etc, stuff to fake that 'bend' of light towards the eye, but I'm not sure if the extra math and nodes for a tiny small strip will be worth it.
I think I've seen this at least a few times in games.
I also created another mesh for the liquid inside the glass, but I'm already having problems with Z-fighting with the camera position.
Despite my constant turning to the Material Compendium (http://udn.epicgames.com/Three/MaterialsCompendium.html), I still am not totally understanding how these calculations are being interpreted. What goes in the A and B slots of the Lerp? and what goes into the "Normal" of the Fresnel?
Edit: Having a liquid mesh also means you can give it some animation for a psuedo physics effect, ala jigglebones in TF2 - [ame="http://www.youtube.com/watch?v=7MPojMf_WSQ"]coffee pot skin jiggle bones test - YouTube[/ame]
I have at least made some progress getting the thing to be transparent now, but still need to figure out the distortion part.
EDIT: ok, I think I've got the basic distortion network down, I definitely am getting that subtle "fish-eye" effect now within the glass:
Question: I am wondering if there is some kind of trick I can utilize with the mask to make it oscillate up and down to give off that look like the liquid is moving on the sides at least
EDIT2: Got some bubbles (via flipbook texture and Cascade) in for effect.
they have very very good ways of setting up liquid movement.
you can then change the speeds at which the liquid moves.
if you are feeling like having a static movement is way too boring, you could always create a material instance and then have it do funky things as the player gets closer or farther away or hits a button.
like changing colour
but first thing first, if you want it to look like its moving, i highly recommend looking at how the UDK materials are set up for water.
i say this because i see a 2nd object in the back of that last picture you posted.
if you have lots of them lining the hallway (thats what it sort of looks like you have planned), it can become very repetitive and takes away from a more natural feeling environment if they have the same identical animations.
Now I need to start working on the "lid" of the liquid, in addition to getting some slight normal/distortions around the glass so that the liquid has a more sludgy feel to it than a "cloudy" one. I definitely saw some Epic liquid/goo materials that looked very interesting, though quite complex, that I'll certainly do my best to reference as I continue constructing the network.
[ame="http://www.youtube.com/watch?v=ovelfgNiyJk"]3D Vector Displacement - UDK (DX9 WorldPositionOffset) - Test #2 - YouTube[/ame]
Then marry it to a Sine or Cosine for the slight ripple effect, but you will need quite a few points of vertices to make it look good.
That's basically what I've managed to set up that somewhat works. I still don't know how I'm going to match the liquid plane to match the texture since it doesn't look like they're really melding together well.
How do I know which vertex colors affect height? I was just painting random colors in Maya, do some colors move the verts in different directions than others?
The upper image is nothing happening when trying to just use the Red channel. The lower image is some deformation when using all channels, however, the deformation is only occuring in the XY plane, not the Z axis which is what I'm trying to get.
This is starting to get very frustrating. There isn't much tutorials or information given on how to set up a vertex displacement node network out there either, at least, nothing that applies to using baked vertices.
Now to get it set up so that the sine is only shifting the vertices upwards instead of side-to-side is tricky
OK, so it looks like you have the basics of your material down, Mul the Vertex node by a Constant of 2 to exaggerate so you can see it better for the testing, then Mul the entire thing by the effect the Time-Sine node and see if the material works.
If this works, then so far, so good, meaning the issues is with the World Position node. Try Masking different channels or using other Position nodes instead, although in all cases, World Position should be used and SHOULD be working.
It's also amazing how quickly a solution can present itself with a little perseverance. Here is the material network I finally figured out for the ripple effect:
Of course, seeing is believing. I'm gonna upload a video to show it in motion, once vimeo lets me :shifty:
EDIT: Finally uploaded. Still needs some work though, might think about redoing some of the baking and getting a better sense of a pattern that would go well with the movement. Also need to work on some improved shader quality for the liquid itself so it looks more like a liquid and less like cloudy water
http://player.vimeo.com/video/47790456
[vv]47848595[/vv]
Going to have to try and bring out those details even more to counteract that issue then.
If I were you I'd focus on two more simple additions to really make the whole prop shine.
1: Add some cube mapping to your glass material to get some reflections coming in from the outside world. This should go a long way in making your glass material pop out more and be distinct from the liquid.
2: Another particle system that creates bubbles that come up and pop on the surface. This could be somewhat optional depending on how viscous you want your liquid to appear, but should be relatively simple to setup.
i dunno if its just me, but the bubbles seem to be moving very quickly for how little surface movement there is.
Or its just the quality of the video.
I dunno. it looks great, but the movement of the liquid looks a little off to me.
If you are, you could make them appear on the bottom (either with scaling them up when they spawn or changing the opacity), have them lay down there for a few seconds and then use velocity over life to make them go upwards.