Make a Water Shader in Cinema 4D

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
Hey there, Joey here for School of Motion. And in this lesson, we're gonna take a look at how you can make something look like it's floating on an ocean, without needing anything more than the built in tools that Cinema 4D has to offer. This lesson is about being clever with the existing tools. We'll take a look at how to build a custom ocean texture, and then get some text to float on the surface like it's riding the waves. While this may sound a bit complex, if you hang in there, by the end of this lesson you'll learn a bunch of new skills about texturing, rigging, and animating that you might not have known before. Don't forget to sign up for our free student account so you can grab the project files from this lesson, as well as assets from any other lesson on the site. And now let's jump into Cinema 4D. All right, so here we are in Cinema, and the first thing we want to do is show you guys what happens normally when you add the scenery plugin. So, if you're not familiar with it, it comes with a bunch of presets and setups for you. So, I'm just gonna add a sunlight setup and I'm gonna add the, let's just go with the blue sky ocean preset, and so by default when you add those two objects, this is the result you get, all right. And anti-aliasing is turned to low, there's no GI, no ambient occlusion, but you can see you got a pretty decent ocean here. And you've got some nice reflections, and the lighting's nice and with a little tweaking this could be a very usable seamless ocean environment. All right, now here's the problem, and the reason I've been getting a lot of emails. Let's say you want something to actually be floating in the water, so let's just take this type and move it down into the water, and do a render. Now, you'll see, the reflections and everything still look great, the problem is you're getting a perfectly straight seamless line all the way across the object where it's intersecting the water. You're not getting any of the waviness, or the ripples, or anything like that. And on top of that, there's no way currently with scenery to have this water actually be 3D water. The way it's doing this is with a bump map. And I'm going to show you guys the difference between a bump map and a true displacement in a little bit. So, how can we actually get this ocean to have waves, and rolling waves, and ripples, and things like that that will interact with the geometry? All right, currently scenery isn't set up for that. Maybe in a later version, I'll add that as a different type of preset. What I'm gonna show you guys is how you can use, you can kind of make your own ocean. And you can still use scenery with it. You can still use these built in 16k skies that we provide. These are all seamless, by the way, you can rotate all the way around them. And you can use those to get great reflections out of your kind of home brewed ocean. So, here's what we're gonna do. I'm gonna open a new Cinema 4D project, and I'm gonna add a floor to it, okay, because I wanna show you something. Now, in scenery, all of the floors in scenery are actually floor objects, because floor objects in Cinema are infinite. So, if I add a material to this and render it, you'll see it actually extends way past where it looks like it's going in my view port here. It looks like it ends here. When I hit render, it goes all the way to the horizon, all right, which is great when you want a seamless floor. One of the problems with that, is that Cinema will not let you put displacement on an infinite floor. And let me show you what displacement is now. All right, so I'm going to get rid of the floor, and I'm gonna replace it with a plane. Let's make it a little bit bigger here. And if you guys are following along, what I'm doing is holding the 5 key, and just clicking and dragging. These are hot keys that everyone should know. 4 let's you hold an object, you click and hold 4 and drag. 5 scales it, and 6 rotates it. All right, so those are kind of the hotkeys for that. So, here we have a plane and so now if I render this you'll see, you know, it renders exactly where we think it would. So, I'm gonna put this texture on here, and then I'm going to change this texture a little bit. And I'm gonna put a bump map on it, and sort of simulate what scenery does. So, let's add a bump channel to the texture, all right. Come into the bump tab here, and let's add some noise to the bump, all right. If I hit render, you'll see that's what we got. Right now, that looks like absolute garbage. The bump channel works in tandem with the specular channel. And it really doesn't work that well unless there is a light in the scene. So, let's put a light in the scene and just put it here. Okay, now it's starting to work a little bit better. Now, what it's kind of telling you is the direction of the light source, and you can kind of see what it's doing if I zoom out and look down at it. It starts to look a little bit better. Even, kind of, starts to look a little bit like water, all right, and this is a similar way that scenery gets its water effect. And you can get a lot of mileage out of this. Now, here's the big problem with it, is when you get really close to the surface of it, that illusion falls apart pretty quick. And it becomes very obvious that there is definitely no depth to this water, you're just faking it. All right, so, what's the way around that? Well, there's another channel in Cinema 4D called displacement, all right. And if we turn off bump, and turn on displacement, and then in the texture slot here we can just add the noise, and you'll see. Let me close this window. Over here, you can see, in the preview now we've got this really spiky looking thing. And that's because displacement actually changes the geometry of the object, all right. So, let's render this and see what happens. Right now, nothing happens. And why is that? Well, there's a few reasons. One, is probably the displacement isn't turned up very high. So, let's really crank the height of this. Okay, now we're getting somewhere. Let me turn that down to 250 and do a render. So, what is this displacement channel actually doing? What it's doing is it's using whatever texture I feed it here, which in this case is just noise, and wherever things are dark, it is going to sort of lower that point of that geometry, and wherever it's white, it's going to raise that point of the geometry, all right, and that's because I have the type of displacement set to intensity centered. Centered means that things can, you know, both increase and decrease. There's another setting here that's just intensity, where things that are black will not be effected and things that are white will be effected, all right. Now, why does it look very jagged like this? Well, because by default, the displacement channel can only work on actual verticis, all right. And you can see that this plane doesn't have that many polygons here, you know. It's not subdivided very much, and so when I render it it looks pretty jagged. So, there's two ways to fix that. One way is you could subdivide this more. I could add more segments to it. If I add 100 and 100 and render. You can see I get a lot more detail now. You don't have to do that, though. Let me set this back to 20. Okay, the other way to do it is to go into the displacement tab, and down here there's a bunch of options for sub-polygon displacement. And if you check this on what it basically does is when you hit render, it subdivides your geometry and then displaces it. So the advantage of doing it that way is you can work with this pretty low detail geometry, and then when you hit render, Cinema does all this work behind the scenes to increase the detail of it, so your displacement map can work really well. And so if I have that checked. Subdivision level four is actually pretty high. I'm gonna set that to two. So, if I hit render now, you can see I'm getting a ton of detail there, all right. So, this is actually pretty cool. You can now come in to this texture here, this noise and click on it. And you get all the options for the noise shader in Cinema 4D and there's a ton of options. The main one I'm gonna mess with right now is the global scale. If we were trying to simulate water here, obviously you don't want thousands of tiny little peaks like this, you want a few big ones. So, I'm going to increase the scale of the noise, kind of stretch it out over a greater distance. So, the global scale is 100 right now. If I make it 1,000 and hit render. You can see I now have this nice wavy kind of look to it. And what's interesting about this is it actually is changing the geometry, and if I move this light over here, you can see the lighting is actually effected by the displacement. And let me turn shadows on. Because, it's really cool. You can actually cast shadows with displaced geometry. So, this is one way to get actual 3D geometry that now can interact with other geometry. If I put a cube in the middle of this, and then hit render. Let me move the light over here, so we can see it. You can see that the geometry is actually intersecting the cube. It's not flat at all. So, this actually works, and this is a possibility, but I quickly decided this wasn't the right way to do an ocean, and the reason for that was because if I want this cube, let's say, to float, and bounce, and bob up and down, based on the motion of the ocean. I'm sorry, I could not help myself. You can't do that with a displacement map very easily. I'm sure there's some very smart people out there who can figure out how to do it. I'm not one of them, so I wanted to figure out a better way. So, let me delete this texture for a minute. Delete the cube and light. So, what would be better is if there was actually a way to make this geometry displace where we could see it, and use it, and it turns out there is. So, what I'm going to do first is scale this baby way up. All right make it really big, and I'm going to add some more subdivision to it. So, I'm going to make this instead of 20 by 20 I'll do 100 by 100, and what you're gonna do is add a deformer to this, so click on your deformer tab. And it's the displacer, all right, and that should give you a hint. Same thing as a displacement map. The difference is, it's actually going to effect the geometry, and we'll be able to see it and use that information. So, in the displacer, you have a few tabs. And the object tab, this is where you set the strength and height. And the shading tab, this is where you set a texture to act as the displacement map to drive the amount of displacement. So, I'm gonna click on this arrow and add a noise shader. So, we're just doing the exact same thing we did in the texture, but we're doing it inside of the deformer. All right, so let's go in noise. Let's turn the global scale up to 2000. Come over here and go to object and let's turn the height way up. And you can see that we're getting pretty much the same result we did before, except now you can actually see it, all right. And this is gonna allow you to attach things to the surface of the ocean. With a texture, I'm not really sure it's possible. But, this way it is possible. So, the first thing that I wanted to do is figure out how do I make big rolling waves for the ocean? And right now the noise, it's kind of giving me these big pillowy looking waves. These don't really look like ocean waves to me. So, what I wanted to do was kind of play with the noise. I'm gonna show you guys a few noise settings that are really great to play with. So, we come down into the shading tab for the displacer, click on noise, bring up our noise settings. Now, the first thing we're gonna check is the type of noise. So, right now, in this noise property here it's set to noise. If you click on this you'll see there's actually quite a few, I mean, there's two or three dozen different types of noise that you can use. And they all have funny names and don't really tell you much. What you can do that is useful is click on this tiny little hidden arrow over here, and you'll see a little preview of each noise. And so you could try to find one that resembles water. And there are ones that are good for smoke, ones that are good for kind of weird effectsy things. The one I found that worked the best for water, in just kind of my opinion, is this one way down here called wavy turbulence. If you look in this little bar it will tell you the name as you scroll over it. So, let's click wavy turbulence. And you can see, you kind of get like some big waves you also get some little ones, and it's kinda nice. Now, it's getting very, you can tell, it's not very smooth right now. It's kind of jagged, and that's just because we don't have a ton of geometry. I could subdivide this even more, but I don't want it to start moving really, really slowly. So, want I'm gonna do is just put this whole thing in HyperNURBS, so we can turn that off, and kind of figure out what our waves are going to look like, and then just turn the HyperNURBS on and get it much smoother, okay. So, there's a few problems with this noise. It's pretty obvious already. So, let's work on that. Let's turn the HyperNURBS off, go in the displacer, click on noise. All right, so the global scale is 1,000. I'm actually going to increase that even more. Let's try 5,000, all right. And now you can see that we've kind of lost a lot of the detail. And that's probably just because there might be giant waves just over here that haven't show up through our plane yet. So, what I wanna do is actually set up some animation to help me visualize what this looks like moving. So, with noise there's two types of animation. There is movement, which is basically taking the entire noise texture and moving it. That's a good thing to do for an ocean, because in general ocean water is sort of drifting in one direction or another. So, let's set that up. So, let's say it's moving in a Z axis direction, you know, so from left to right. And I think it's already set up that way by default. This movement here, this is actually telling Cinema 4D a direction, so, all you have to do is put one in one of these directions and that's the direction the noise will move. And then the speed tells it how fast it's moving. Now, what I've found is a little bit goes a long way. If I put this up to 5% and hit play, you can see how quickly it moves. It's way too fast. So, let's try 1%, all right, that's not too bad. Let's just leave it like that for now. And so now while it's doing this I'm gonna play with the global scale, and just kind of try and find a setting that seems to work well. So, 5,000 looks funny. It's definitely not intense enough. But, then I might be able to just increase the height, too. All right, and what we're looking for here, we're looking for, you know, basically what if you were on the surface of this, does this feel like something the ocean does. The answer is no. It doesn't feel like it. So, let's go into noise and let's turn that global scale way up, like 50,000. And try and get some really big waves, all right. And just kind of step back in increments of 10,000 until we get something that sorta starts to feel like, like an overall wavy motion. All right, maybe back to 10,000. Now, you know, what might help this is if we go into the noise. Go into displacer, go into noise, and we can also animate the evolution of this noise. And what that means is it's gonna kinda change the noise over time. And that setting is this animation speed. So, just to show you guys, what the difference is, if I turn this speed down to zero. So, nothing's happening, but I turn this speed to one, right, you can see now it's kind of, it's changing over time and it's actually kind of looking a little bit more ocean like, all right. So, let's make this comp a lot longer, like 500 frames, and that way we can really see what's happening. So, when you have this animation, plus this, set this to one. I can't seem to type, there we go. You start to get some really interesting motion. Now, this is sorta feeling a little bit like cloth, or something like that, to me. So, I want to try some different noises. Another one that I found that worked okay, was this, I don't know how to pronounce it. It looks like stupal, all right. Now, this one, I think I need to turn the speed way down, because it seems to react a lot faster. So, I'm gonna turn both the speeds down. And this is kind of interesting, but its a little bit too frenetic and random feeling. So, let's try some other ones. We could just try blistered turbulence. And this is actually starting to feel okay. Let's play with the speeds a little bit. And let's play with the global scale. All right so this is 25,000, we're getting some pretty, pretty big waves, so let's turn that down to 5,000 and see what we get. All right, that's kind of interesting. Another thing to play with is this octave setting, so let me show you what this does. If I turn that up, I think the highest it goes is 20. It adds a lot more high frequency noise. High frequency noise are these little chattering things. Low frequency noise are the bigger movements. If you turn this to one. It gets really simple, okay. So, let's turn it to two, let's try three, right. And you're starting to get some, just kind of gentle ocean waves, all right. And we can turn it back up to five. Five is where it was by default. And you can see we're starting to get a lot of little, you know, high frequency. And what I want to do is try and take that high frequency out, and do that with a bump map. You know, let's get the basic movement down using the displacer, and that way we can have things rock and float on this water. But, then we can use texture to actually make it feel more like water. Now, we're gonna be, I'm kind picturing my camera kind of right down on the surface of this thing, okay. So, this is moving way too much right now. It looks kind of cool, actually, but I think it is maybe a little bit too high. So, I'm gonna turn the height down, let's try 2,000. Let's see what that looks like. Okay, so now, if you're down on the surface of this, and something's floating here, one thing you've gotta be careful of is because there is an edge to this, if you're gonna use this as an ocean, you've gotta make sure that edge can be hidden by the contours of this, okay. So, I'm just gonna play with noise a little bit more. I'm gonna turn the global scale down to 4,000. Try and get a few more little waves and bumps out of it. All right, and that's a good start, I think, okay. All right, so why don't we take this, this whole set up here, and let's go back into our scenery scene. And let me just change this. This should say float. I can make it a little thinner. Okay, let's move our camera out of here. Okay, so, the first thing we need to do is turn off scenery's floor. Now, scenery is an object reset, which means that it's built out of Cinema 4D tools, and the things that are all ready built into the program. It's just kind of rigged together with a lot of espresso and python. And by default, I'm hiding all of that just to make it simple to use. You can turn that stuff on. And the way you do it is you go into your layers tab, and there's two sets of layers for sight. There's the controls, which are visible. There's the layers which are not. If you turn the layers on, if you look under the M, and you click that little icon, you'll see all of these scenery objects actually show up and you can see all the tags that are on them, and things like that. And this floor object, which I've called the luminant, that is the one we want to turn off. So, I'm just gonna disable it. All right, and now I'm going to paste the ocean from the other scene, okay. So, now if we play this, all right we can kind figure out where we need our camera to be. All right, and it's feeling like it's moving a little fast, too. So, you know, looking at it in context always helps. I wanna slow down the noise a little bit. So, I'm gonna go back into the displacer, noise, and I'm just gonna slow down both the animation speed and the movement. All right, that's a little bit better. It could probably even be a little slower than that. All right, for now that's good. We're getting some nice rolling waves. You could probably play with the noise a lot more. And get it a lot closer to actual ocean. For the purposes of this we're good. So, now how do we texture this? That is a very long answer. And I wanna just point out right now that the goal of this is not to give you the perfect ocean texture. It's because that takes a lot of tweaking. I've seen other tutorials where they kind of walk through it, and people have spent weeks trying to perfect an ocean shader. So, it's really, what I want you guys to understand is how to approach building an ocean shader. And then you can tweak it to your heart's content. So, let's start out with just making a new material. Let's call this water. Let's apply it to our plane. All right our HyperNURBS right now is off, by the way. If you turn it on it'll smooth things out, but we don't need it. It's actually looking fairly smooth without it. So, first thing I usually do, in any material, is I deal with the color channel. All right, so what color is water? Well, it's blue. And it's actually not blue. It's actually sort of depends. It can be clear, or brown, or even a little bit green. It just kinda depends on what it's reflecting. So, a lot of color from water actually comes from the reflection of what ever is around it. Luckily scenery has a beautiful sky that it can reflect. So that'll help, but you should give it a base color. So, I'm just gonna pick, you know, this blue color here. And when I rendered this you saw another problem. And this is a bigger problem that comes up when you do things like this, is that your sky isn't gonna extend far enough down to hide the scene. And so one of the good things about scenery is that I can kind of find, let me make this a little bit longer here. I can kind of find a frame where the water is the lowest. Maybe it's. It's probably here. And I can see the horizon line, and that's this dashed line Cinema is showing me. That is where, by default, the sky ends. I can go into the scenery object, though, and there's a vertical shift parameter for the sky. And I can just lower it. So, now that sky will, you know, always meet the surface of the water. And it kind of feels like we're down in the ocean. Which is kind of cool. All right, and oh, I think I see a little bit poking out there, so I may have to lower it a bit more, or just lower the camera to kind of hide that. All right, good. So, let's turn on reflection on this texture and see if that helps. When you turn on reflection, water is pretty reflective So, let's keep that at, like, 80, and just do a quick render and see what that looks like. Okay, so, you're getting some nice reflections of the clouds, and anti-aliasing is on the lowest setting right now. And so that's why it looks very jagged. But, it's also incredibly smooth. It's like chrome right now. There is another thing that happens with water and glass which is the Fresnel effect. Things reflect more at a sharper angle to your eye than they do to a more oblique angle. So, you have to use a Fresnel shader in the texture. I just realized that I explained that horribly. Let me see. If I turn Fresnel on, it'll probably make more sense. Okay, so let's turn Fresnel on, and let's set the mix mode to multiply. And what that's gonna let me do, by changing it from normal to multiply, it means I can still use this brightness here to make it less reflective, but the Fresnel will sort of get combined with it, okay. So, if I take this Fresnel, and I really crank it back like this, here's what you're seeing. At these very extreme angles here, you're seeing reflections. But as the angle, and by angle what I'm referring to is what is the angle between my eye and this piece of the water. This piece of the water is at an angle towards me. I'm looking, kind of perpendicular to it. So, I don't want that to be as reflective as this stuff up here. Now, I've really, you know, I've over done it here to show you guys. But, this is what Fresnel does. And if I drag this black box, you know, further back, you can see I'm starting to bring back those reflections closer and closer. So, you know, I probably want it something like this. I just wanna kinda get more reflections on these peaks than on the parts that are facing me, all right, and it's a little bit of a subtle effect, but without it, especially once your scene is lit, and it gets a little busier, you will start to notice that it just doesn't look right. Okay, so that's the reflection channel. The specular channel, so they way I tend to think of specular is height is the, sort of, glossiness of it. Right, as I turn the height up, you get a brighter hot spot. And width is sort of the dullness of it. So, if the width is really high, then light kind of spills out across the whole thing. And if width is low, you just get this tiny little hot spot. And that's closer to the way water works. So it's a high height, and a low width. All right, so let's try that. All right, and there's not a lot of lights in this scene, so you're not gonna get a lot of specular, but, the sunlight object that's in here is actually an infinite light, so you should get some. Especially once we add a bump map. So, next let's add a bump map. And we're going to kind of bounce around a lot here as we do this. So, I added a bump channel I'm going to add noise to that bump channel, and I'm gonna go into the noise, and I'm gonna choose, let's try this stuple texture. And let's just see what it does by default, okay. So, by default, it actually does kinda look swirly like water. It's very, very, heavy, and I think the scale is wrong. But, you can see that that bump did some really nice things to the reflections, to the speculars, it kind of broke it up. And it doesn't really look like, you know, a blob of liquid metal anymore. It's starting to resemble something that might one day approach being called water. So what I'm going to do is increase the global scale. Let's try 1,000. All right, so we can just get some bigger swirls. 1,000's too big, because now I can't actually see it at all. Let's try 200. Okay, that's kinda nice. I'm gonna turn, now, for the demonstration purposes of this tutorial, I don't wanna get too far into animating the noise textures, and things like that. On the render that you saw at the beginning of this video, all of these noise textures that I'm using are animated to try and make it feel more realistic. And those are things you have to do to get a good water texture, but that would take forever to do a tutorial for, so maybe next time. But, just know that you would want to animate probably the movement, and the evolution of this noise. What I'm noticing right now is that I'm seeing some good rippling here with this bump map. But, I also, kinda want some fatter ripples. This is kind of a sharp ripple. And I might even bring that global scale down to 100. Because I kind of like these sharp little edges that you get here, but I also want some bigger kind of ripples kind of buried in there. So, I kinda need two noises, not just one. So, how can you combine two noise shaders? This is where, probably the most powerful shader in all of Cinema 4D comes in, and that is the layer shader. So, the way the layer shader works is if you already have something in your texture box here, and you click on this arrow, go down here and click layer. So, what it does now in the texture box it says layer. And if I click on that, you'll see I've got this little. It almost looks like the Photoshop layer browser, and that's exactly what it is. You can now add different images, different shaders, even effects like, you know, you can colorize and adjust brightness, things like that. You can do all of this in this one shader, and the result of that is what gets used in your channel. So, it's very, very powerful. So, if I start with this noise, this kind of fine, sharp noise, but I wanna add another noise that's a little duller and a little more ripply, what I can do is click on shader, add a new noise shader. And this one is the default noise. Let's see what that looks like. That one looks very ripply, right, and the ripples are way too big right now. So, why don't we turn that down quite a ways. And they're also very strong. You're getting a really dark edge here, which is probably too dark. So, what I'm gonna do, and I wanna name these so I can remember what they are. So, this is my ripply noise. And then this is my sharp noise. So, I'm gonna turn sharp noise off for a minute. And ripply noise I'm gonna just turn, I'm gonna turn the opacity of it down. Turn it way down, actually. Let's try five. Okay, so, at 5% it just gives it a little bit of a rippliness to it, which is kinda nice. Then I can turn on the sharp noise. I can actually put sharp noise on top of it. And by default, this normal here, this is the transfer mode. So, if sharp noise is on top of ripply noise, and it's set to normal, your not gonna see ripply noise at all. However, just like in Photoshop, if I set this from normal to add, you know, or screen, then it will combine the lightest parts of both images and I can get the ripply noise, and the sharp noise, and now just to show you, if I turn ripply noise back up, you can now change the noise and test my renders, and I'm getting ripply and I'm getting sharp, and it's kinda starting to look a little bit more like water. This big blob over here, I'm not sure if that's specularity or reflection. And that right now is the biggest problem that I'm having with this render. So, let's figure that out. What I'm gonna do is turn off the specular channel for a minute, and see if that's the problem. Okay, that was the problem. There was a specular hit right there, that was way too intense for water. So, let's go into the specular and let's turn the width down even further, let's try 5%. All right, that is better. See now, you're getting kind of these highlights. This is closer to what water actually does. It doesn't get these big, round, fat specular hits, okay. Cool. All right, so now let's talk about the color channel some more. So, water, you know, it's not always the exact same color all over the ocean. So, what we could do is we could use some noise to kind of make it a little splotchier. But, the main thing I'm noticing is that it's just so even. There's no shadows to it. And it just looks too flat, even with lighting, it's not really giving me what I want. So, what I'm gonna do is go into the color channel for this material, and for texture, I'm gonna add a layer shader, and just start with a blank layer shader. There's nothing in it, okay. So, why don't we start with the base color, so the base color for the water is going to be this color here. So, I'm gonna drag that into my quick storage panel down here which I like to use. If you don't see this on your Cinema, click this little arrow, and make sure show quick storage is enabled, and then you can drag colors to it, and they'll pop up everywhere, and you can save your colors that way. So, let's add a shader called color, and when you're in the layer shader, you click on the little icon next to the name of the shader. That takes you into the options for that. So, let's open quick storage and click that blue. Okay, so, we're starting with blue. So now we're basically back to where we started. Now, on top of the blue, I wanna add a Fresnel shader. I wanna use the same trick we did with reflection, but I wanna do it with color. And what I want is, I want water that is facing me to be brighter than water that is not facing me. And the reason for that is because if water is facing me it means that it's kind of like a wave up in the air. And as I'm looking through it, that is a thin piece of water compared to the water that is not facing me. It's facing straight up and down, because that water is looking straight down into the ocean which is very deep and so it's going to be darker, because light can't pass through it the way it can a piece that's up in the air. If you look at, you know, this wave in the distance here. If you were looking at this, you would actually be looking straight through this wave to the back of it. You would see some light. Not a lot, but a little bit of light would make it's way to your eye. It would appear brighter than let's say the water in this little valley right here. Because that water, if you're looking at it, it's pulling down into the ocean where it's very dark. So, let's add a Fresnel shader. And by default it's just going to override your color. And we can click on this, and we can really crank these values to see what it's doing, okay. All right, so right now, you can see what its doing is everything that is facing me is getting this black color. And everything that's not facing me is getting brightened. All right and, that, let's see if we back this off a little bit. All right, so this is kinda they effect we're going for, actually, it's just that the color isn't working at all. You know, you don't actually want, you don't want the sea to turn white. You want it to be just a little bit brighter. All right, so what I'm going to do is, I'm going to change this white into, I'm gonna click on this blue from my quick storage, and I'm just going to brighten that a little bit. And so now, you're getting some nice deep blues here, but you're getting some brighter ones up here. And you know it's kind of mimicking that effect of, I guess it would be, kind of like subsurface scattering, where light is passing through thinner parts of the object and changing the color. All right, and what's cool is now we can dial that in a little bit. We can just play with the opacity of it. So, it just affects it a little bit, okay. And if I turn that off, and do a render, and then turn it on, you'll see it's a subtle thing, but it just helps with the contrast a little bit, okay. Cool, so, as far as the texture goes, this could use a lot of work. You know, I'm gonna show you one more trick, and then I wanna show you how to make the word float actually float on the water. But, I encourage you to get in and play with the layer shader, because there's just so much you can do with it. And you can really build these elaborate, really cool, textures that people will look at, and they'll be like, how in the world is that even possible. And it's possible because you can stack these things, and have hundreds of them all doing different things. So, one big thing that's missing right here is that white, kind of foamy stuff that pops up when there's waves. And I don't mean big, white cap waves, because that's not what these waves are. I mean just like the surface foaminess that happens on the ocean when it's moving. So, let's think about the best way to do that. It seem foam, and things like that, they're all kind of based off of noise. So, we're gonna use a noise shader. So, let's just add one. And let's just see what it looks like. The noise shader on its own, no, it doesn't help us at all. It kinda just muddies everything up, but you can see where there's light and dark areas, you know. So, what I'm gonna do is I'm gonna first try to find a noise that resembles sea foam. And I think, just by looking sometimes it's hard to tell. This fire one, could be promising. You know, and you can try different ones, too. I think the one I like is this stupal one, and the reason is it kind of has these build in, I know it's kinda hard to see on the screen capture. But it's kinda got these built in wavy structures to it that really help it feel like liquid. So, what I wanna do is, I wanna get rid of everything that's not really, really white on this noise. So, I'm gonna come down here, in this section here, the low clip, and high clip. This is kind of like controlling the contrast. There is a contrast control as well, but low clip just let's you control the blacks. And you can see as I adjust it, make it higher, and higher and higher, you can see up here in the preview it's getting rid of more and more, and it's just leaving these little white areas. And even just by doing that, I'm starting to get some foamy stuff, okay, which is cool. So, the foam looks a little bit big to me, so I wanna turn the global scale down a little bit, maybe to 50, there we go. And I'd want it to be a little bit brighter, too. So, I can bring the high clip down, and I'll get more white out of it. Okay, and you can see now, you're kind of getting these little foamy elements on the surface of the water, too. Right now they're evenly distributed everywhere, so while if you look at one little piece of this it looks great, overall it looks weird. Water really shouldn't be like that. So, and on top of that, you can see that we've lost all oft he nice color and detail underneath, because this noise effect, it needs to be screened over the color, so I'm gonna change this to screen. So, now we're getting our Fresnel, and we're getting that all in one shader, all right, so again the power of the layer shader. So, now I'm going to show you guys a really cool trick. I don't want this foam everywhere. I want little patches of it. So, now how the heck do we do that? That's actually trickier so, what I would do in Photoshop is I would have the foam on a layer, and that layer would have a mat. It would have another black and white image that's controlling the transparency where it's showing through. You can actually do that in the layer shader. So, let's grab another noise shader, all right, and let's turn the contrast way up, so I can actually just kind of visualize what we're gonna be able to use for a mat. Because, what we're going to do here is create a mat. Now, if I use this as a mat, this might actually work fairly well, but I'd like to try to have bigger sections of foam and no foam. So let's turn the global scale up, maybe like 300. All right, something like this might actually work, because over here you'd have a big area with no foam. And here you'd have a big area with foam. Now, I don't want these hard edges, because that's gonna kinda look weird, too. So, I'm gonna turn the contrast down a little bit, and now I'm gonna get a nice, soft, result. So now, how do we use this noise texture as a mat for our foam noise? All right, let's go back to the layer shader and let's name these layers so we can identify them. So, this is gonna be our foam. And then this one we must created is gonna be our mat. So, you can actually use a mat in this layer shader. And the way you do that, it feels a little backwards to me, but the way it works is the mat layer actually goes underneath the layer it's going to mat out, okay. So, we set that from normal, to layer mask, which is the very bottom option. And you can see up here in the preview, that it's actually cut out the layer that's directly above it. So, we're only getting noise in these few areas, all right. And if we do a quick test render, you can see there's noise here, there's foam here, there's foam here, but there's not really any foam over here, there's a little bit. And it just kind of breaks it up, all right. And if I turn this off show you guys again. Here is where that foam appears everywhere. And it kind of ends up looking, almost like a, I don't know, it looks like a bad fabric or something. And then when you turn this back on, the layer mask, and turn it on, then now it breaks it up. All right, and it's just a little bit more natural. So, this is where I'm going to leave the texture. This is not bad. And I think if you started, if you did a render with this, you would start to notice some of the sin, but it's a good start. And now that you guys understand how you can build really complicated layer based shaders like this, you could figure out how to do this exact thing in the bump channel, in the diffusion channel, you could even do it in the reflection channel. So, you can do a lot of things to get your textures to feel good. The next thing I want to show you guys is how you get this type to float on the surface of this. All right, so let's, I'm gonna just put a little protection tag on this camera, so we don't move it because I like where it is. All right, so first things first, let's position this word in the ocean. So, let's take this object, let's just move it down so it's actually in the ocean, ad let's rotate it, so it's kind of lying on the back. All right, cool, so we like that. Now, obviously if I hit play, this is what's going to happen, and that's not going to work very well. So, how can we get this onto the surface? Well, there is a pretty easy way that I've figured out. So, the first thing we're gonna do is hide this. I'm gonna create a new null, and I'm gonna call this float null, okay. Now, this null right now is just floating in midair. I'm gonna put a tag on it, so I'm gonna control click, and add a character tag, and the character tag I want is constraint. Now, the constraint tag, it basically attaches two objects together, and it gives you a bunch of different ways to attach them together, and, you know, I'm not going to go over every single one, but once you learn how to do this one way, you'll be able to figure out what the rest of these options do. So, in this constraint tag, we're going to activate the clamp option, and clamp actually just means it's going to restrict one object's motion, based on another object. So, when you add a constraint, like a clamp constraint, you have to tell the tag which object to clamp the current object to. So, the float null has the tag. It's going to be clamped to whatever object I drag into this target box here. And you can have multiple targets, okay, and sometimes you want that. In this case, we just want one target. And that target is going to be our plane. And now you can see why it's very important that we didn't use a displacement texture, because we actually need to drag this geometry down into this target box, and it will use this displacement to calculate where the surface of this thing is. So, the next step is, we have a target, and we have to change a couple of settings on it, okay. So, the first setting is how do we wanna clamp this float null to this plane up here? Do we want to clamp it to the origin of the plane, or something else? If you click on this box here, it gives you a bunch of options. And we wanna clamp it to the surface of that plane. Okay, so click surface, and you see as soon as I did that the null jumped and is now on the surface of this ocean. And what's cool is if I switch to move tool, and I move this null around, it's a little bit hard to see here, but you can see it actually follows the contour, and stays always on the surface. It's impossible for me to lift it off. But I can move it this way, and I can move it this way. And it will follow the surface, okay, so perfect. And what's even better is as this thing moves, this thing will move up and down with it, all right? Now, you're probably starting to see how this is gonna work, right? So, that's part one. Just to show you what will happen now, if I, let me unhide my type object. And I'm gonna move the float null right over it, okay. And let's position this thing kinda where we want it. And then I'm going to parent the type under the float null. And if we hit play, it's floating, okay, pretty awesome. It doesn't look that realistic, because all it's doing is floating up and down. It's not rotating at all. And we want really want it to kind of bob up and down, like a real, like a boat would. So, we have to do one more thing, all right. This float null, right now all it's doing is adjusting its position. It's not adjusting its orientation. So, I wanna turn that on. I'm going to go back into the constraint tag, and the second set of options down here where it says, align. So, the first option is which axis are we aligning to, and I want to align to the Y axis, all right, that's correct. Now, how do I want to align? For something like this, you wanna use what's called the normal. Now, think of the normal as the direction that a polygon is facing from a model. Okay, so, because this ocean is being distorted, you can see this polygon right here is pointed a little bit off to the right. It's at a little bit of an angle. It's mostly up and down, but not totally up and down. And that angle is the normal. Okay, I'm not really sure why it's called the normal, but that's what it's called. So, now if I look at the float null, when we play it, you can see that it actually is orienting appropriately, okay. So, let's turn this back on and take a look. I mean, that's the basics of itright there. That's kind of how it works. So now, just to show you guys one thing that can happen when you do this, what I'm going to do is I'm going to go into displacer, and I'm going to turn the global scale down a little bit. And I'm going to turn the height up a little bit. Okay, all right, so now it's still working, okay. But, you can see that it's kind of doing some weird stuff and it's a little bit jerky in points. Right, so what's happening is this null is right here. But when you have a very turbulent surface, points that are very close together might actually be very different heights. So, like in this case here, when we get to this frame, let me scoot the camera around here. So, our null is kinda here, but then on the right side of our object, the ocean is higher there. So, how can we kinda compensate, for a more turbulent ocean like this? Well, there's actually a pretty cool way. So the first thing that I'm gonna do is take my object out of this null and turn it off. So, what I like to do is get one null set up and then just copy it, and move the copy over a little bit, move the copy over a little bit, move the copy over a little bit, and you end up with a few different nulls, right, that are all on the same surface, okay. And what you can then do, is take this object and I'm going to hit option G. Option G, whatever object is selected it groups it under a null, and it puts the null in the exact same spot as the object. It's a very handy thing to do sometimes. So, now I'm gonna call this float null main. And what I wanna do is put a constraint tag on this null, have it look at these four nulls and kind of average the position out, and the rotation out. So, the way we're gonna do that is we're gonna add constraint tag. So, character, constraint. That's not a constraint tag. Let's try that again. Okay, now this time instead of the clamp, we could use this constraint. It's called the PSR constraint. And I'll just show you what it looks like. PSR it lets you constrain one object's position, scale, rotation, or just some combination of those three to another object. And if you add multiple targets to this, it will average out the PSR of all those objects. So, it's pretty cool, it's pretty handy. In this case, if we do that, it's gonna give us a pretty jerky feeling animation. So, what we need to do is actually not use PSR. We're gonna use a variation of PSR, called spring. So, spring, it kind of works the same way. It take the position scale rotation of one or more objects, averages them out, and then applies that to whatever object has the tag on it. However, it does it in kind of a springy way. It's a little bit looser, and you can control that looseness. So, with this float null selected, I'm in the constraint tag. I'm going to add, there's already one target setup, right, so I'm going to add my first null, and you can see that what it did is it set the length here pretty high. It figures out how far away these two nulls are and it assumes I want to keep them that far apart, and that's not what I want. I actually want them as close together as possible. So, I'm gonna change this length to zero. And I'm gonna check position, and rotation, and then I'm gonna add three more targets, and I'm gonna just, one by one, add all of these nulls to those targets, set their lengths to zero, and activate position and rotation. And if we hit play now, it's gonna kinda settle at first, all right, and once it settles, you can see that now. And actually, this'll probably work a lot better if I position this thing in the ocean. It's gonna take the average of those four nulls. And you can see the nulls are here, one, two, three, four. So, you kinda wanna position your type around that. Because that's where it's kinda measuring how high the ocean is. Okay, and you can see that now it's actually kind of taken average of those nulls, and so this moves a little bit smoother, and it kind of smooths out the motion of it. Right, so here's where we've ended up. We've got our float object, and it's sort of constrained to a bunch of different nulls. And it's kind of getting the average of all their positions, and rotations, and it's using that information to smooth out, and just kind of float on the surface. And right now it's kind of going, you know, up and down, and it bounces a little bit, and it really is a pretty natural animation. Now, you're noticing every time the animation resets, this jumps, right, back into position. That's because it's set up as a spring. So, what you actually need to do is go to the first few frames, and I'm using the F and G keys to go one frame forward and back. And just kinda go back and forth, because what happens is you go back and forth, Cinema is running this spring simulation, right. And once you get, once it settles, go back to frame zero, frame by frame, and then set key frames on this float null main. I just hit F9 and set position scale rotation key frames. And now when I hit play, it starts in the right position. And you can see that it's actually started a little bit high, so I'll have to adjust that. But, now when it goes back, when you start it at frame zero it'll start in the right position. These things are a little finicky, but a lot of times, and this works with dynamics as well, you have to set a key frame on the first frame of your animation to make sure things begin in the right place. So, anyway, so there you go. We've got a floating type. You've got a rippling ocean. And you know how to begin the journey of coming up with a really good ocean shader. And when you put all of those things together, You can get a really, really cool animation. And you could even put the camera in this rig and have it feel like the camera is floating on the surface of the ocean. There's a lot of things you could do with this, and the constraint tag is very, very powerful. There's other uses for it, but this is a great one. So, there you go, thank you guys so much, and I will talk to you soon. Thanks so much for watching. I hope you learned some new things in Cinema 4D today. From how to create custom shaders, to a new way of rigging something that you may not have thought of before. And if you have any questions, or thoughts, let us know, and we'd love to hear from you. if you use any of these techniques on a project. So, give us a shout on Twitter @schoolofmotion and show us your work. And if you learned something valuable from this video, please share it around. It really helps us spread the word about School of Motion, and we truly appreciate it. Don't forget to sign up for our free student account to access project files from the lesson that you've just watched, plus a whole bunch of other cool stuff. Thanks again, and I'll see you next time.
Info
Channel: School of Motion
Views: 11,718
Rating: undefined out of 5
Keywords: motion graphics, tutorial, Cinema 4D, Tutorial, Water, Float, Shader, Effect, Simulation, Render
Id: pae9WW_SPLE
Channel Id: undefined
Length: 60min 43sec (3643 seconds)
Published: Mon Jun 26 2017
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.