Make a Water Shader in Cinema 4D

Software like Realflow is expensive and time consuming to learn, and you're not always going to have the time or budget to learn a brand new piece of software for a project. In this lesson you're going to learn how to make an ocean shader from scratch. You'll gain a TON of knowledge about how shaders work in Cinema 4D that you can use to build your own custom shaders.

You'll also learn how to animate waves procedurally so you won't need to use a ton of manual keyframes on something as complex as an ocean. We'll even attach an object to those waves to get it to bob up and down, just like it would in the real world. There's a lot to learn in this lesson, so grab your notepads and pay attention!

If you have any questions, click over to the Q&A tab to post them. Other students can answer you, and we'll put our team on the case to try and get you a solution ASAP.
    00:00:00,497(ocean waves crashing)
    00:00:01,525(seagulls crying)
    00:00:07,253(playful music)
    00:00:17,469- Hey there, Joey here for School of Motion.
    00:00:19,572And in this lesson, we're gonna take a look
    00:00:21,255at how you can make something look
    00:00:23,042like it's floating on an ocean, without needing
    00:00:25,108anything more than the built in tools
    00:00:26,991that Cinema 4D has to offer.
    00:00:29,336This lesson is about being clever with the existing tools.
    00:00:32,815We'll take a look at how to build a custom ocean texture,
    00:00:35,392and then get some text to float on the surface
    00:00:38,252like it's riding the waves.
    00:00:39,549While this may sound a bit complex, if you hang in there,
    00:00:41,885by the end of this lesson you'll learn
    00:00:43,692a bunch of new skills about texturing,
    00:00:45,561rigging, and animating that you might not have known before.
    00:00:48,604Don't forget to sign up for our free student account
    00:00:51,250so you can grab the project files from this lesson,
    00:00:53,421as well as assets from any other lesson on the site.
    00:00:55,840And now let's jump into Cinema 4D.
    00:01:00,358All right, so here we are in Cinema, and the first thing
    00:01:04,142we want to do is show you guys what happens normally
    00:01:07,417when you add the scenery plugin.
    00:01:10,619So, if you're not familiar with it,
    00:01:12,745it comes with a bunch of presets and setups for you.
    00:01:15,462So, I'm just gonna add a sunlight setup
    00:01:18,429and I'm gonna add the, let's just go with the blue sky
    00:01:24,156ocean preset, and so by default when you add those two
    00:01:30,271objects, this is the result you get, all right.
    00:01:35,545And anti-aliasing is turned to low, there's no GI,
    00:01:38,740no ambient occlusion, but you can see you got
    00:01:41,236a pretty decent ocean here.
    00:01:45,242And you've got some nice reflections,
    00:01:46,831and the lighting's nice and with a little tweaking
    00:01:50,931this could be a very usable seamless ocean environment.
    00:01:55,215All right, now here's the problem,
    00:01:57,966and the reason I've been getting a lot of emails.
    00:02:00,253Let's say you want something to actually be floating
    00:02:03,051in the water, so let's just take this type
    00:02:05,548and move it down into the water, and do a render.
    00:02:07,637Now, you'll see, the reflections and everything
    00:02:10,946still look great, the problem is you're getting
    00:02:13,233a perfectly straight seamless line all the way across
    00:02:17,181the object where it's intersecting the water.
    00:02:19,266You're not getting any of the waviness, or the ripples,
    00:02:21,634or anything like that.
    00:02:22,798And on top of that, there's no way currently with scenery
    00:02:26,732to have this water actually be 3D water.
    00:02:31,041The way it's doing this is with a bump map.
    00:02:34,475And I'm going to show you guys the difference
    00:02:36,590between a bump map and a true displacement in a little bit.
    00:02:40,331So, how can we actually get this ocean
    00:02:45,145to have waves, and rolling waves, and ripples,
    00:02:48,442and things like that that will interact with the geometry?
    00:02:52,195All right, currently scenery isn't set up for that.
    00:02:54,842Maybe in a later version, I'll add that as
    00:02:57,312a different type of preset.
    00:02:59,430What I'm gonna show you guys is how you can use,
    00:03:02,820you can kind of make your own ocean.
    00:03:05,177And you can still use scenery with it.
    00:03:07,242You can still use these built in 16k skies
    00:03:10,095that we provide.
    00:03:11,643These are all seamless, by the way, you can rotate
    00:03:13,881all the way around them.
    00:03:15,335And you can use those to get great reflections
    00:03:17,936out of your kind of home brewed ocean.
    00:03:21,976So, here's what we're gonna do.
    00:03:23,856I'm gonna open a new Cinema 4D project,
    00:03:26,678and I'm gonna add a floor to it, okay,
    00:03:29,859because I wanna show you something.
    00:03:31,645Now, in scenery, all of the floors in scenery
    00:03:36,094are actually floor objects, because floor objects
    00:03:38,857in Cinema are infinite.
    00:03:40,703So, if I add a material to this and render it,
    00:03:43,439you'll see it actually extends way past
    00:03:46,102where it looks like it's going in my view port here.
    00:03:49,792It looks like it ends here.
    00:03:51,545When I hit render, it goes all the way to the horizon,
    00:03:54,923all right, which is great when you want a seamless floor.
    00:03:58,164One of the problems with that, is that Cinema will not
    00:04:02,576let you put displacement on an infinite floor.
    00:04:06,280And let me show you what displacement is now.
    00:04:09,966All right, so I'm going to get rid of the floor,
    00:04:11,852and I'm gonna replace it with a plane.
    00:04:13,951Let's make it a little bit bigger here.
    00:04:16,009And if you guys are following along,
    00:04:17,909what I'm doing is holding the 5 key,
    00:04:21,275and just clicking and dragging.
    00:04:23,004These are hot keys that everyone should know.
    00:04:25,4554 let's you hold an object, you click and hold 4 and drag.
    00:04:29,7095 scales it, and 6 rotates it.
    00:04:33,432All right, so those are kind of the hotkeys for that.
    00:04:35,688So, here we have a plane and so now if I render this
    00:04:40,210you'll see, you know, it renders exactly
    00:04:42,382where we think it would.
    00:04:44,198So, I'm gonna put this texture on here,
    00:04:48,002and then I'm going to change this texture a little bit.
    00:04:49,965And I'm gonna put a bump map on it,
    00:04:51,663and sort of simulate what scenery does.
    00:04:54,202So, let's add a bump channel to the texture, all right.
    00:04:59,091Come into the bump tab here, and let's add
    00:05:01,671some noise to the bump, all right.
    00:05:05,161If I hit render, you'll see that's what we got.
    00:05:07,392Right now, that looks like absolute garbage.
    00:05:09,601The bump channel works in tandem with the specular channel.
    00:05:15,336And it really doesn't work that well
    00:05:16,973unless there is a light in the scene.
    00:05:18,585So, let's put a light in the scene and just put it here.
    00:05:21,728Okay, now it's starting to work a little bit better.
    00:05:23,903Now, what it's kind of telling you
    00:05:26,652is the direction of the light source,
    00:05:28,525and you can kind of see what it's doing
    00:05:30,615if I zoom out and look down at it.
    00:05:34,818It starts to look a little bit better.
    00:05:36,140Even, kind of, starts to look a little bit
    00:05:39,102like water, all right, and this is a similar way
    00:05:41,534that scenery gets its water effect.
    00:05:44,489And you can get a lot of mileage out of this.
    00:05:47,516Now, here's the big problem with it,
    00:05:49,493is when you get really close to the surface of it,
    00:05:52,894that illusion falls apart pretty quick.
    00:05:54,738And it becomes very obvious that there is definitely
    00:05:57,979no depth to this water, you're just faking it.
    00:06:00,917All right, so, what's the way around that?
    00:06:03,838Well, there's another channel in Cinema 4D
    00:06:07,500called displacement, all right.
    00:06:09,589And if we turn off bump, and turn on displacement,
    00:06:13,072and then in the texture slot here
    00:06:14,740we can just add the noise, and you'll see.
    00:06:18,459Let me close this window.
    00:06:20,175Over here, you can see, in the preview now
    00:06:22,825we've got this really spiky looking thing.
    00:06:26,041And that's because displacement actually changes
    00:06:29,614the geometry of the object, all right.
    00:06:32,113So, let's render this and see what happens.
    00:06:34,203Right now, nothing happens.
    00:06:35,673And why is that?
    00:06:37,321Well, there's a few reasons.
    00:06:39,253One, is probably the displacement isn't turned up very high.
    00:06:42,884So, let's really crank the height of this.
    00:06:46,103Okay, now we're getting somewhere.
    00:06:47,481Let me turn that down to 250 and do a render.
    00:06:51,559So, what is this displacement channel actually doing?
    00:06:56,517What it's doing is it's using whatever texture
    00:06:58,626I feed it here, which in this case is just noise,
    00:07:01,483and wherever things are dark,
    00:07:03,692it is going to sort of lower that point of that geometry,
    00:07:10,402and wherever it's white, it's going to raise
    00:07:12,597that point of the geometry, all right,
    00:07:14,686and that's because I have the type of displacement
    00:07:17,345set to intensity centered.
    00:07:20,289Centered means that things can, you know,
    00:07:23,238both increase and decrease.
    00:07:26,761There's another setting here that's just intensity,
    00:07:30,125where things that are black will not be effected
    00:07:31,984and things that are white will be effected, all right.
    00:07:34,607Now, why does it look very jagged like this?
    00:07:37,326Well, because by default, the displacement channel
    00:07:40,386can only work on actual verticis, all right.
    00:07:45,520And you can see that this plane doesn't have
    00:07:47,612that many polygons here, you know.
    00:07:50,419It's not subdivided very much, and so when I render it
    00:07:54,102it looks pretty jagged.
    00:07:55,621So, there's two ways to fix that.
    00:07:57,154One way is you could subdivide this more.
    00:08:00,542I could add more segments to it.
    00:08:02,866If I add 100 and 100 and render.
    00:08:05,792You can see I get a lot more detail now.
    00:08:08,209You don't have to do that, though.
    00:08:10,426Let me set this back to 20.
    00:08:15,250Okay, the other way to do it is
    00:08:18,527to go into the displacement tab,
    00:08:21,641and down here there's a bunch of options
    00:08:23,371for sub-polygon displacement.
    00:08:26,036And if you check this on what it basically does
    00:08:28,433is when you hit render, it subdivides your geometry
    00:08:32,504and then displaces it.
    00:08:35,109So the advantage of doing it that way
    00:08:37,802is you can work with this pretty low detail geometry,
    00:08:41,665and then when you hit render, Cinema does all this work
    00:08:45,210behind the scenes to increase the detail of it,
    00:08:48,110so your displacement map can work really well.
    00:08:50,629And so if I have that checked.
    00:08:52,512Subdivision level four is actually pretty high.
    00:08:55,682I'm gonna set that to two.
    00:08:57,952So, if I hit render now, you can see
    00:08:59,337I'm getting a ton of detail there, all right.
    00:09:01,645So, this is actually pretty cool.
    00:09:04,943You can now come in to this texture here,
    00:09:09,149this noise and click on it.
    00:09:11,053And you get all the options for the noise shader
    00:09:13,626in Cinema 4D and there's a ton of options.
    00:09:16,112The main one I'm gonna mess with right now
    00:09:18,689is the global scale.
    00:09:20,430If we were trying to simulate water here,
    00:09:22,524obviously you don't want thousands of tiny little peaks
    00:09:27,133like this, you want a few big ones.
    00:09:29,441So, I'm going to increase the scale of the noise,
    00:09:31,795kind of stretch it out over a greater distance.
    00:09:33,867So, the global scale is 100 right now.
    00:09:36,607If I make it 1,000 and hit render.
    00:09:39,333You can see I now have this nice wavy kind of look to it.
    00:09:43,792And what's interesting about this is it actually is
    00:09:46,045changing the geometry, and if I move this light over here,
    00:09:52,461you can see the lighting is actually effected
    00:09:54,041by the displacement.
    00:09:57,210And let me turn shadows on.
    00:09:59,312Because, it's really cool.
    00:10:01,208You can actually cast shadows with displaced geometry.
    00:10:04,343So, this is one way to get actual 3D geometry
    00:10:12,524that now can interact with other geometry.
    00:10:16,220If I put a cube in the middle of this, and then hit render.
    00:10:20,655Let me move the light over here, so we can see it.
    00:10:27,958You can see that the geometry
    00:10:29,034is actually intersecting the cube.
    00:10:31,011It's not flat at all.
    00:10:32,777So, this actually works, and this is a possibility,
    00:10:36,873but I quickly decided this wasn't the right way
    00:10:39,773to do an ocean, and the reason for that
    00:10:42,343was because if I want this cube, let's say,
    00:10:45,187to float, and bounce, and bob up and down,
    00:10:47,555based on the motion of the ocean.
    00:10:51,364I'm sorry, I could not help myself.
    00:10:52,694You can't do that with a displacement map very easily.
    00:10:56,971I'm sure there's some very smart people out there
    00:10:59,560who can figure out how to do it.
    00:11:00,906I'm not one of them, so I wanted to figure out a better way.
    00:11:04,342So, let me delete this texture for a minute.
    00:11:07,258Delete the cube and light.
    00:11:08,765So, what would be better is if there was actually a way
    00:11:11,797to make this geometry displace where we could see it,
    00:11:16,743and use it, and it turns out there is.
    00:11:19,332So, what I'm going to do first is scale this baby way up.
    00:11:23,077All right make it really big, and I'm going to add
    00:11:25,740some more subdivision to it.
    00:11:28,039So, I'm going to make this instead of 20 by 20
    00:11:30,152I'll do 100 by 100, and what you're gonna do
    00:11:34,611is add a deformer to this, so click on your deformer tab.
    00:11:37,879And it's the displacer, all right,
    00:11:41,019and that should give you a hint.
    00:11:42,598Same thing as a displacement map.
    00:11:43,918The difference is, it's actually going to effect
    00:11:46,894the geometry, and we'll be able to see it
    00:11:49,271and use that information.
    00:11:50,662So, in the displacer, you have a few tabs.
    00:11:54,754And the object tab, this is where you set
    00:11:58,198the strength and height.
    00:11:59,941And the shading tab, this is where you set a texture
    00:12:02,714to act as the displacement map
    00:12:05,559to drive the amount of displacement.
    00:12:08,756So, I'm gonna click on this arrow and add a noise shader.
    00:12:12,320So, we're just doing the exact same thing
    00:12:13,910we did in the texture, but we're doing it
    00:12:15,768inside of the deformer.
    00:12:18,458All right, so let's go in noise.
    00:12:20,375Let's turn the global scale up to 2000.
    00:12:22,778Come over here and go to object
    00:12:27,338and let's turn the height way up.
    00:12:28,771And you can see that we're getting pretty much
    00:12:31,801the same result we did before,
    00:12:33,403except now you can actually see it, all right.
    00:12:36,920And this is gonna allow you to attach things
    00:12:41,716to the surface of the ocean.
    00:12:43,626With a texture, I'm not really sure it's possible.
    00:12:46,998But, this way it is possible.
    00:12:48,996So, the first thing that I wanted to do
    00:12:51,062is figure out how do I make big rolling waves
    00:12:55,098for the ocean?
    00:12:56,566And right now the noise, it's kind of giving me
    00:13:00,931these big pillowy looking waves.
    00:13:02,853These don't really look like ocean waves to me.
    00:13:04,503So, what I wanted to do was kind of play with the noise.
    00:13:09,878I'm gonna show you guys a few noise settings
    00:13:11,991that are really great to play with.
    00:13:14,107So, we come down into the shading tab for the displacer,
    00:13:17,556click on noise, bring up our noise settings.
    00:13:20,703Now, the first thing we're gonna check is the type of noise.
    00:13:25,114So, right now, in this noise property here
    00:13:27,713it's set to noise.
    00:13:29,538If you click on this you'll see there's actually
    00:13:32,115quite a few, I mean, there's two or three dozen
    00:13:34,982different types of noise that you can use.
    00:13:35,981And they all have funny names
    00:13:38,184and don't really tell you much.
    00:13:39,673What you can do that is useful
    00:13:41,218is click on this tiny little hidden arrow over here,
    00:13:44,038and you'll see a little preview of each noise.
    00:13:46,825And so you could try to find one that resembles water.
    00:13:52,951And there are ones that are good for smoke,
    00:13:55,556ones that are good for kind of weird effectsy things.
    00:13:58,145The one I found that worked the best for water,
    00:14:01,626in just kind of my opinion, is this one way down here
    00:14:04,920called wavy turbulence.
    00:14:06,992If you look in this little bar
    00:14:09,192it will tell you the name as you scroll over it.
    00:14:11,554So, let's click wavy turbulence.
    00:14:13,467And you can see, you kind of get like some big waves
    00:14:16,600you also get some little ones, and it's kinda nice.
    00:14:19,238Now, it's getting very, you can tell,
    00:14:22,872it's not very smooth right now.
    00:14:24,941It's kind of jagged, and that's just because we don't have
    00:14:28,459a ton of geometry.
    00:14:30,570I could subdivide this even more, but I don't want it
    00:14:33,913to start moving really, really slowly.
    00:14:36,527So, want I'm gonna do is just put this whole thing
    00:14:39,670in HyperNURBS, so we can turn that off,
    00:14:42,449and kind of figure out what our waves
    00:14:44,759are going to look like, and then just turn
    00:14:47,719the HyperNURBS on and get it much smoother, okay.
    00:14:50,734So, there's a few problems with this noise.
    00:14:52,050It's pretty obvious already.
    00:14:53,362So, let's work on that.
    00:14:54,984Let's turn the HyperNURBS off, go in the displacer,
    00:14:57,878click on noise.
    00:14:59,306All right, so the global scale is 1,000.
    00:15:01,826I'm actually going to increase that even more.
    00:15:04,213Let's try 5,000, all right.
    00:15:06,992And now you can see that we've
    00:15:09,565kind of lost a lot of the detail.
    00:15:11,157And that's probably just because there might be
    00:15:13,912giant waves just over here
    00:15:18,170that haven't show up through our plane yet.
    00:15:20,814So, what I wanna do is actually set up
    00:15:23,337some animation to help me visualize
    00:15:25,832what this looks like moving.
    00:15:27,716So, with noise there's two types of animation.
    00:15:30,595There is movement, which is basically taking
    00:15:34,990the entire noise texture and moving it.
    00:15:38,710That's a good thing to do for an ocean,
    00:15:42,157because in general ocean water is sort of drifting
    00:15:45,502in one direction or another.
    00:15:47,476So, let's set that up.
    00:15:49,206So, let's say it's moving in a Z axis direction,
    00:15:56,308you know, so from left to right.
    00:15:58,979And I think it's already set up that way by default.
    00:16:02,982This movement here, this is actually telling
    00:16:06,052Cinema 4D a direction, so, all you have to do
    00:16:09,314is put one in one of these directions
    00:16:12,495and that's the direction the noise will move.
    00:16:14,388And then the speed tells it how fast it's moving.
    00:16:16,590Now, what I've found is a little bit goes a long way.
    00:16:20,629If I put this up to 5% and hit play,
    00:16:23,559you can see how quickly it moves.
    00:16:25,206It's way too fast.
    00:16:26,528So, let's try 1%, all right, that's not too bad.
    00:16:32,518Let's just leave it like that for now.
    00:16:34,496And so now while it's doing this I'm gonna play
    00:16:37,638with the global scale, and just kind of try
    00:16:39,791and find a setting that seems to work well.
    00:16:43,366So, 5,000 looks funny.
    00:16:46,989It's definitely not intense enough.
    00:16:49,865But, then I might be able to just increase the height, too.
    00:16:58,483All right, and what we're looking for here,
    00:17:00,863we're looking for, you know, basically
    00:17:02,976what if you were on the surface of this,
    00:17:05,739does this feel like something the ocean does.
    00:17:08,699The answer is no.
    00:17:11,103It doesn't feel like it.
    00:17:12,252So, let's go into noise
    00:17:13,785and let's turn that global scale way up, like 50,000.
    00:17:19,102And try and get some really big waves, all right.
    00:17:22,213And just kind of step back in increments of 10,000
    00:17:25,418until we get something that sorta starts to feel like,
    00:17:27,898like an overall wavy motion.
    00:17:34,645All right, maybe back to 10,000.
    00:17:38,142Now, you know, what might help this
    00:17:40,580is if we go into the noise.
    00:17:42,124Go into displacer, go into noise, and we can also
    00:17:46,264animate the evolution of this noise.
    00:17:48,220And what that means is it's gonna kinda change
    00:17:50,398the noise over time.
    00:17:51,784And that setting is this animation speed.
    00:17:54,797So, just to show you guys, what the difference is,
    00:17:56,844if I turn this speed down to zero.
    00:17:59,040So, nothing's happening, but I turn this speed to one,
    00:18:03,543right, you can see now it's kind of, it's changing over time
    00:18:09,977and it's actually kind of looking a little bit
    00:18:12,914more ocean like, all right.
    00:18:15,329So, let's make this comp a lot longer, like 500 frames,
    00:18:21,239and that way we can really see what's happening.
    00:18:23,419So, when you have this animation, plus this,
    00:18:27,531set this to one.
    00:18:29,851I can't seem to type, there we go.
    00:18:32,059You start to get some really interesting motion.
    00:18:35,479Now, this is sorta feeling a little bit like cloth,
    00:18:39,659or something like that, to me.
    00:18:42,137So, I want to try some different noises.
    00:18:44,935Another one that I found that worked okay,
    00:18:45,961was this, I don't know how to pronounce it.
    00:18:47,320It looks like stupal, all right.
    00:18:49,778Now, this one, I think I need to turn the speed way down,
    00:18:54,272because it seems to react a lot faster.
    00:18:58,964So, I'm gonna turn both the speeds down.
    00:19:01,218And this is kind of interesting,
    00:19:04,615but its a little bit too frenetic and random feeling.
    00:19:10,525So, let's try some other ones.
    00:19:11,604We could just try blistered turbulence.
    00:19:15,869And this is actually starting to feel okay.
    00:19:19,782Let's play with the speeds a little bit.
    00:19:22,809And let's play with the global scale.
    00:19:27,189All right so this is 25,000, we're getting
    00:19:29,914some pretty, pretty big waves, so let's turn that down
    00:19:33,872to 5,000 and see what we get.
    00:19:37,565All right, that's kind of interesting.
    00:19:39,322Another thing to play with is this octave setting,
    00:19:43,978so let me show you what this does.
    00:19:45,208If I turn that up, I think the highest it goes is 20.
    00:19:47,379It adds a lot more high frequency noise.
    00:19:50,816High frequency noise are these little chattering things.
    00:19:54,320Low frequency noise are the bigger movements.
    00:19:56,723If you turn this to one.
    00:20:01,740It gets really simple, okay.
    00:20:03,854So, let's turn it to two, let's try three, right.
    00:20:06,254And you're starting to get some, just kind of gentle
    00:20:08,126ocean waves, all right.
    00:20:11,029And we can turn it back up to five.
    00:20:12,863Five is where it was by default.
    00:20:14,461And you can see we're starting to get
    00:20:16,253a lot of little, you know, high frequency.
    00:20:18,657And what I want to do is try and take
    00:20:21,013that high frequency out, and do that with a bump map.
    00:20:25,855You know, let's get the basic movement down
    00:20:28,513using the displacer, and that way we can have things
    00:20:31,462rock and float on this water.
    00:20:33,871But, then we can use texture to actually make it feel
    00:20:38,056more like water.
    00:20:39,102Now, we're gonna be, I'm kind picturing my camera
    00:20:42,225kind of right down on the surface of this thing, okay.
    00:20:44,837So, this is moving way too much right now.
    00:20:48,365It looks kind of cool, actually, but I think it is maybe
    00:20:52,546a little bit too high.
    00:20:54,415So, I'm gonna turn the height down, let's try 2,000.
    00:20:57,921Let's see what that looks like.
    00:21:00,994Okay, so now, if you're down on the surface of this,
    00:21:03,785and something's floating here,
    00:21:05,420one thing you've gotta be careful of is
    00:21:08,485because there is an edge to this,
    00:21:11,107if you're gonna use this as an ocean,
    00:21:13,340you've gotta make sure that edge can be hidden
    00:21:16,020by the contours of this, okay.
    00:21:17,020So, I'm just gonna play with noise a little bit more.
    00:21:19,586I'm gonna turn the global scale down to 4,000.
    00:21:21,954Try and get a few more little waves and bumps out of it.
    00:21:25,344All right, and that's a good start, I think, okay.
    00:21:29,071All right, so why don't we take this,
    00:21:33,470this whole set up here, and let's go back
    00:21:35,919into our scenery scene.
    00:21:37,517And let me just change this.
    00:21:42,434This should say float.
    00:21:46,066I can make it a little thinner.
    00:21:52,221Okay, let's move our camera out of here.
    00:21:54,446Okay, so, the first thing we need to do is turn off
    00:21:56,691scenery's floor.
    00:21:58,838Now, scenery is an object reset, which means
    00:22:02,171that it's built out of Cinema 4D tools,
    00:22:06,304and the things that are all ready built into the program.
    00:22:08,440It's just kind of rigged together
    00:22:10,412with a lot of espresso and python.
    00:22:13,607And by default, I'm hiding all of that
    00:22:16,516just to make it simple to use.
    00:22:18,445You can turn that stuff on.
    00:22:20,283And the way you do it is you go into your layers tab,
    00:22:23,046and there's two sets of layers for sight.
    00:22:25,760There's the controls, which are visible.
    00:22:27,720There's the layers which are not.
    00:22:29,571If you turn the layers on, if you look under the M,
    00:22:32,353and you click that little icon, you'll see
    00:22:35,164all of these scenery objects actually show up
    00:22:38,449and you can see all the tags that are on them,
    00:22:40,484and things like that.
    00:22:41,575And this floor object, which I've called the luminant,
    00:22:45,395that is the one we want to turn off.
    00:22:47,797So, I'm just gonna disable it.
    00:22:49,830All right, and now I'm going to paste
    00:22:53,719the ocean from the other scene, okay.
    00:22:56,761So, now if we play this,
    00:22:58,387all right we can kind figure out
    00:23:02,308where we need our camera to be.
    00:23:05,004All right, and it's feeling like it's moving
    00:23:06,734a little fast, too.
    00:23:08,592So, you know, looking at it in context always helps.
    00:23:11,494I wanna slow down the noise a little bit.
    00:23:13,874So, I'm gonna go back into the displacer, noise,
    00:23:15,773and I'm just gonna slow down both the animation speed
    00:23:19,459and the movement.
    00:23:24,287All right, that's a little bit better.
    00:23:26,133It could probably even be a little slower than that.
    00:23:30,442All right, for now that's good.
    00:23:32,019We're getting some nice rolling waves.
    00:23:34,272You could probably play with the noise a lot more.
    00:23:38,592And get it a lot closer to actual ocean.
    00:23:41,216For the purposes of this we're good.
    00:23:43,085So, now how do we texture this?
    00:23:45,244That is a very long answer.
    00:23:47,519And I wanna just point out right now
    00:23:49,815that the goal of this is not to give you
    00:23:51,291the perfect ocean texture.
    00:23:52,893It's because that takes a lot of tweaking.
    00:23:55,600I've seen other tutorials where they
    00:23:57,632kind of walk through it, and people have spent weeks
    00:23:59,605trying to perfect an ocean shader.
    00:24:02,516So, it's really, what I want you guys to understand
    00:24:07,303is how to approach building an ocean shader.
    00:24:09,683And then you can tweak it to your heart's content.
    00:24:12,141So, let's start out with just making a new material.
    00:24:16,858Let's call this water.
    00:24:20,527Let's apply it to our plane.
    00:24:24,043All right our HyperNURBS right now is off, by the way.
    00:24:27,006If you turn it on it'll smooth things out,
    00:24:28,944but we don't need it.
    00:24:30,013It's actually looking fairly smooth without it.
    00:24:31,714So, first thing I usually do, in any material,
    00:24:37,406is I deal with the color channel.
    00:24:39,568All right, so what color is water?
    00:24:41,760Well, it's blue.
    00:24:43,304And it's actually not blue.
    00:24:47,056It's actually sort of depends.
    00:24:50,677It can be clear, or brown, or even a little bit green.
    00:24:53,743It just kinda depends on what it's reflecting.
    00:24:56,212So, a lot of color from water actually comes
    00:24:58,759from the reflection of what ever is around it.
    00:25:01,661Luckily scenery has a beautiful sky that it can reflect.
    00:25:06,189So that'll help, but you should give it a base color.
    00:25:09,881So, I'm just gonna pick, you know, this blue color here.
    00:25:12,853And when I rendered this you saw another problem.
    00:25:16,522And this is a bigger problem that comes up
    00:25:18,635when you do things like this,
    00:25:19,889is that your sky isn't gonna extend far enough down
    00:25:23,867to hide the scene.
    00:25:25,706And so one of the good things about scenery
    00:25:29,560is that I can kind of find, let me make this
    00:25:33,003a little bit longer here.
    00:25:34,703I can kind of find a frame where the water is the lowest.
    00:25:40,111Maybe it's.
    00:25:43,515It's probably here.
    00:25:44,768And I can see the horizon line, and that's this
    00:25:47,358dashed line Cinema is showing me.
    00:25:49,483That is where, by default, the sky ends.
    00:25:53,172I can go into the scenery object, though,
    00:25:56,112and there's a vertical shift parameter for the sky.
    00:26:00,625And I can just lower it.
    00:26:03,631So, now that sky will, you know,
    00:26:06,686always meet the surface of the water.
    00:26:08,193And it kind of feels like we're down in the ocean.
    00:26:10,317Which is kind of cool.
    00:26:13,922All right, and oh, I think I see a little bit
    00:26:16,998poking out there, so I may have to lower it a bit more,
    00:26:19,796or just lower the camera to kind of hide that.
    00:26:22,753All right, good.
    00:26:23,755So, let's turn on reflection on this texture
    00:26:27,827and see if that helps.
    00:26:30,536When you turn on reflection, water is pretty reflective
    00:26:36,225So, let's keep that at, like, 80,
    00:26:38,570and just do a quick render and see what that looks like.
    00:26:42,506Okay, so, you're getting some nice reflections
    00:26:45,478of the clouds, and anti-aliasing is on
    00:26:47,262the lowest setting right now.
    00:26:49,063And so that's why it looks very jagged.
    00:26:51,747But, it's also incredibly smooth.
    00:26:54,916It's like chrome right now.
    00:26:57,215There is another thing that happens with water and glass
    00:27:01,441which is the Fresnel effect.
    00:27:03,854Things reflect more at a sharper angle to your eye
    00:27:11,621than they do to a more oblique angle.
    00:27:13,813So, you have to use a Fresnel shader in the texture.
    00:27:19,437I just realized that I explained that horribly.
    00:27:21,700Let me see.
    00:27:22,706If I turn Fresnel on, it'll probably make more sense.
    00:27:26,098Okay, so let's turn Fresnel on,
    00:27:28,325and let's set the mix mode to multiply.
    00:27:31,530And what that's gonna let me do,
    00:27:33,601by changing it from normal to multiply,
    00:27:35,130it means I can still use this brightness here
    00:27:38,348to make it less reflective, but the Fresnel
    00:27:42,444will sort of get combined with it, okay.
    00:27:44,921So, if I take this Fresnel, and I really crank it back
    00:27:51,314like this, here's what you're seeing.
    00:27:54,148At these very extreme angles here,
    00:27:58,515you're seeing reflections.
    00:27:59,747But as the angle, and by angle what I'm referring to
    00:28:02,487is what is the angle between my eye
    00:28:04,873and this piece of the water.
    00:28:07,003This piece of the water is at an angle towards me.
    00:28:09,882I'm looking, kind of perpendicular to it.
    00:28:12,286So, I don't want that to be as reflective
    00:28:15,973as this stuff up here.
    00:28:18,624Now, I've really, you know, I've over done it here
    00:28:20,993to show you guys.
    00:28:22,358But, this is what Fresnel does.
    00:28:23,624And if I drag this black box, you know, further back,
    00:28:27,667you can see I'm starting to bring back those reflections
    00:28:31,669closer and closer.
    00:28:33,346So, you know, I probably want it something like this.
    00:28:38,451I just wanna kinda get more reflections on these peaks
    00:28:42,769than on the parts that are facing me, all right,
    00:28:45,397and it's a little bit of a subtle effect,
    00:28:47,982but without it, especially once your scene is lit,
    00:28:51,330and it gets a little busier,
    00:28:52,498you will start to notice that it just doesn't look right.
    00:28:55,533Okay, so that's the reflection channel.
    00:28:57,309The specular channel, so they way I tend to think
    00:29:02,915of specular is height is the, sort of, glossiness of it.
    00:29:09,079Right, as I turn the height up, you get a brighter hot spot.
    00:29:12,576And width is sort of the dullness of it.
    00:29:16,533So, if the width is really high,
    00:29:18,925then light kind of spills out across the whole thing.
    00:29:22,526And if width is low, you just get this tiny little hot spot.
    00:29:24,810And that's closer to the way water works.
    00:29:27,239So it's a high height, and a low width.
    00:29:30,722All right, so let's try that.
    00:29:32,754All right, and there's not a lot of lights
    00:29:35,122in this scene, so you're not gonna get
    00:29:36,746a lot of specular, but, the sunlight object
    00:29:40,647that's in here is actually an infinite light,
    00:29:43,000so you should get some.
    00:29:44,869Especially once we add a bump map.
    00:29:47,497So, next let's add a bump map.
    00:29:51,109And we're going to kind of bounce around a lot here
    00:29:55,231as we do this.
    00:29:56,238So, I added a bump channel
    00:29:58,307I'm going to add noise to that bump channel,
    00:30:00,698and I'm gonna go into the noise,
    00:30:02,324and I'm gonna choose, let's try this stuple texture.
    00:30:08,452And let's just see what it does by default, okay.
    00:30:11,380So, by default, it actually does kinda look
    00:30:13,628swirly like water.
    00:30:16,601It's very, very, heavy, and I think the scale is wrong.
    00:30:18,796But, you can see that that bump
    00:30:20,262did some really nice things to the reflections,
    00:30:22,362to the speculars, it kind of broke it up.
    00:30:24,198And it doesn't really look like, you know,
    00:30:26,644a blob of liquid metal anymore.
    00:30:28,017It's starting to resemble something
    00:30:29,640that might one day approach being called water.
    00:30:33,033So what I'm going to do is increase the global scale.
    00:30:37,514Let's try 1,000.
    00:30:40,254All right, so we can just get some bigger swirls.
    00:30:42,4831,000's too big, because now I can't actually see it at all.
    00:30:46,058Let's try 200.
    00:30:50,599Okay, that's kinda nice.
    00:30:52,805I'm gonna turn, now, for the demonstration purposes
    00:30:56,311of this tutorial, I don't wanna get too far
    00:30:58,535into animating the noise textures, and things like that.
    00:31:01,497On the render that you saw at the beginning of this video,
    00:31:04,259all of these noise textures that I'm using are animated
    00:31:08,277to try and make it feel more realistic.
    00:31:11,624And those are things you have to do
    00:31:13,225to get a good water texture, but that would take forever
    00:31:15,791to do a tutorial for, so maybe next time.
    00:31:19,345But, just know that you would want to animate
    00:31:23,362probably the movement, and the evolution of this noise.
    00:31:28,180What I'm noticing right now is that I'm seeing
    00:31:34,821some good rippling here with this bump map.
    00:31:38,838But, I also, kinda want some fatter ripples.
    00:31:43,258This is kind of a sharp ripple.
    00:31:45,897And I might even bring that global scale down to 100.
    00:31:48,343Because I kind of like these sharp little edges
    00:31:51,383that you get here, but I also want
    00:31:52,722some bigger kind of ripples kind of buried in there.
    00:31:55,057So, I kinda need two noises, not just one.
    00:31:58,482So, how can you combine two noise shaders?
    00:32:02,137This is where, probably the most powerful shader
    00:32:05,855in all of Cinema 4D comes in,
    00:32:06,965and that is the layer shader.
    00:32:09,204So, the way the layer shader works is
    00:32:11,855if you already have something in your texture box here,
    00:32:16,791and you click on this arrow, go down here and click layer.
    00:32:21,099So, what it does now in the texture box it says layer.
    00:32:23,861And if I click on that, you'll see I've got this little.
    00:32:26,598It almost looks like the Photoshop layer browser,
    00:32:29,469and that's exactly what it is.
    00:32:31,176You can now add different images, different shaders,
    00:32:34,436even effects like, you know, you can colorize
    00:32:38,487and adjust brightness, things like that.
    00:32:41,403You can do all of this in this one shader,
    00:32:43,621and the result of that is what gets used in your channel.
    00:32:47,302So, it's very, very powerful.
    00:32:49,178So, if I start with this noise,
    00:32:51,306this kind of fine, sharp noise,
    00:32:53,393but I wanna add another noise that's a little duller
    00:32:55,720and a little more ripply, what I can do
    00:32:58,320is click on shader, add a new noise shader.
    00:33:02,089And this one is the default noise.
    00:33:05,275Let's see what that looks like.
    00:33:06,459That one looks very ripply, right,
    00:33:09,193and the ripples are way too big right now.
    00:33:11,529So, why don't we turn that down quite a ways.
    00:33:15,895And they're also very strong.
    00:33:17,998You're getting a really dark edge here,
    00:33:21,952which is probably too dark.
    00:33:23,659So, what I'm gonna do, and I wanna name these
    00:33:26,538so I can remember what they are.
    00:33:27,838So, this is my ripply noise.
    00:33:30,810And then this is my sharp noise.
    00:33:34,092So, I'm gonna turn sharp noise off for a minute.
    00:33:36,174And ripply noise I'm gonna just turn,
    00:33:38,878I'm gonna turn the opacity of it down.
    00:33:43,930Turn it way down, actually.
    00:33:45,435Let's try five.
    00:33:46,600Okay, so, at 5% it just gives it a little bit
    00:33:49,661of a rippliness to it, which is kinda nice.
    00:33:52,460Then I can turn on the sharp noise.
    00:33:54,958I can actually put sharp noise on top of it.
    00:33:56,793And by default, this normal here, this is the transfer mode.
    00:34:02,257So, if sharp noise is on top of ripply noise,
    00:34:05,304and it's set to normal, your not gonna see
    00:34:07,229ripply noise at all.
    00:34:08,937However, just like in Photoshop,
    00:34:10,505if I set this from normal to add, you know, or screen,
    00:34:15,869then it will combine the lightest parts
    00:34:19,595of both images and I can get the ripply noise,
    00:34:23,600and the sharp noise, and now just to show you,
    00:34:25,306if I turn ripply noise back up,
    00:34:26,907you can now change the noise and test my renders,
    00:34:33,771and I'm getting ripply and I'm getting sharp,
    00:34:36,140and it's kinda starting to look
    00:34:37,626a little bit more like water.
    00:34:38,773This big blob over here, I'm not sure
    00:34:42,372if that's specularity or reflection.
    00:34:45,748And that right now is the biggest problem
    00:34:47,517that I'm having with this render.
    00:34:48,895So, let's figure that out.
    00:34:50,699What I'm gonna do is turn off the specular channel
    00:34:54,192for a minute, and see if that's the problem.
    00:34:59,069Okay, that was the problem.
    00:35:00,656There was a specular hit right there,
    00:35:02,854that was way too intense for water.
    00:35:05,466So, let's go into the specular and let's turn the width down
    00:35:08,691even further, let's try 5%.
    00:35:12,512All right, that is better.
    00:35:13,826See now, you're getting kind of these highlights.
    00:35:16,703This is closer to what water actually does.
    00:35:19,457It doesn't get these big, round, fat specular hits, okay.
    00:35:24,434All right, so now let's talk about
    00:35:27,003the color channel some more.
    00:35:28,779So, water, you know, it's not always the exact same color
    00:35:34,782all over the ocean.
    00:35:36,175So, what we could do is we could use some noise
    00:35:39,888to kind of make it a little splotchier.
    00:35:41,759But, the main thing I'm noticing is that it's just so even.
    00:35:46,415There's no shadows to it.
    00:35:47,658And it just looks too flat, even with lighting,
    00:35:51,880it's not really giving me what I want.
    00:35:54,844So, what I'm gonna do is go into the color channel
    00:35:57,851for this material, and for texture, I'm gonna add
    00:36:01,519a layer shader, and just start with a blank layer shader.
    00:36:05,523There's nothing in it, okay.
    00:36:07,856So, why don't we start with the base color,
    00:36:11,771so the base color for the water is going to be
    00:36:13,695this color here.
    00:36:15,312So, I'm gonna drag that into my quick storage panel
    00:36:18,399down here which I like to use.
    00:36:20,351If you don't see this on your Cinema,
    00:36:22,819click this little arrow, and make sure show quick storage
    00:36:25,424is enabled, and then you can drag colors to it,
    00:36:28,639and they'll pop up everywhere,
    00:36:32,111and you can save your colors that way.
    00:36:33,308So, let's add a shader called color,
    00:36:37,116and when you're in the layer shader, you click on
    00:36:39,739the little icon next to the name of the shader.
    00:36:42,874That takes you into the options for that.
    00:36:44,870So, let's open quick storage and click that blue.
    00:36:49,105Okay, so, we're starting with blue.
    00:36:50,990So now we're basically back to where we started.
    00:36:52,417Now, on top of the blue, I wanna add a Fresnel shader.
    00:36:57,259I wanna use the same trick we did with reflection,
    00:36:59,823but I wanna do it with color.
    00:37:01,843And what I want is, I want water that is facing me
    00:37:06,942to be brighter than water that is not facing me.
    00:37:09,783And the reason for that is because if water is facing me
    00:37:12,950it means that it's kind of like a wave up in the air.
    00:37:16,736And as I'm looking through it, that is a thin piece of water
    00:37:19,999compared to the water that is not facing me.
    00:37:24,090It's facing straight up and down,
    00:37:25,889because that water is looking straight down into the ocean
    00:37:28,857which is very deep and so it's going to be darker,
    00:37:31,343because light can't pass through it
    00:37:33,328the way it can a piece that's up in the air.
    00:37:35,839If you look at, you know, this wave in the distance here.
    00:37:39,438If you were looking at this, you would actually be looking
    00:37:42,666straight through this wave to the back of it.
    00:37:45,196You would see some light.
    00:37:47,029Not a lot, but a little bit of light
    00:37:48,433would make it's way to your eye.
    00:37:49,794It would appear brighter than let's say
    00:37:52,650the water in this little valley right here.
    00:37:56,574Because that water, if you're looking at it,
    00:37:59,727it's pulling down into the ocean where it's very dark.
    00:38:02,099So, let's add a Fresnel shader.
    00:38:07,055And by default it's just going to override your color.
    00:38:10,866And we can click on this, and we can really crank
    00:38:14,558these values to see what it's doing, okay.
    00:38:18,677All right, so right now, you can see what its doing
    00:38:20,916is everything that is facing me is getting this black color.
    00:38:26,284And everything that's not facing me is getting brightened.
    00:38:29,696All right and, that, let's see
    00:38:33,041if we back this off a little bit.
    00:38:38,451All right, so this is kinda they effect we're going for,
    00:38:41,039actually, it's just that the color isn't working at all.
    00:38:43,676You know, you don't actually want,
    00:38:46,193you don't want the sea to turn white.
    00:38:49,435You want it to be just a little bit brighter.
    00:38:51,183All right, so what I'm going to do is,
    00:38:53,359I'm going to change this white into,
    00:38:56,131I'm gonna click on this blue from my quick storage,
    00:38:57,933and I'm just going to brighten that a little bit.
    00:39:02,805And so now, you're getting some nice deep blues here,
    00:39:06,673but you're getting some brighter ones up here.
    00:39:09,504And you know it's kind of mimicking that effect
    00:39:13,548of, I guess it would be, kind of like subsurface scattering,
    00:39:16,773where light is passing through thinner parts of the object
    00:39:19,919and changing the color.
    00:39:21,279All right, and what's cool is now we can dial that in
    00:39:25,135a little bit.
    00:39:26,575We can just play with the opacity of it.
    00:39:28,432So, it just affects it a little bit, okay.
    00:39:30,557And if I turn that off, and do a render,
    00:39:35,456and then turn it on, you'll see it's a subtle thing,
    00:39:38,394but it just helps with the contrast a little bit, okay.
    00:39:41,354Cool, so, as far as the texture goes,
    00:39:46,289this could use a lot of work.
    00:39:48,223You know, I'm gonna show you one more trick,
    00:39:50,909and then I wanna show you how to make the word float
    00:39:53,219actually float on the water.
    00:39:54,703But, I encourage you to get in and play
    00:39:57,005with the layer shader, because there's just so much
    00:39:59,159you can do with it.
    00:40:00,383And you can really build these elaborate,
    00:40:02,670really cool, textures that people will look at,
    00:40:09,922and they'll be like, how in the world is that even possible.
    00:40:12,049And it's possible because you can stack these things,
    00:40:14,478and have hundreds of them all doing different things.
    00:40:17,810So, one big thing that's missing right here
    00:40:20,594is that white, kind of foamy stuff
    00:40:24,321that pops up when there's waves.
    00:40:27,521And I don't mean big, white cap waves,
    00:40:30,289because that's not what these waves are.
    00:40:31,876I mean just like the surface foaminess that happens
    00:40:35,235on the ocean when it's moving.
    00:40:37,057So, let's think about the best way to do that.
    00:40:41,827It seem foam, and things like that,
    00:40:45,604they're all kind of based off of noise.
    00:40:47,972So, we're gonna use a noise shader.
    00:40:50,405So, let's just add one.
    00:40:52,303And let's just see what it looks like.
    00:40:53,870The noise shader on its own,
    00:40:58,003no, it doesn't help us at all.
    00:40:59,443It kinda just muddies everything up,
    00:41:00,774but you can see where there's
    00:41:02,566light and dark areas, you know.
    00:41:03,971So, what I'm gonna do is I'm gonna first
    00:41:06,419try to find a noise that resembles sea foam.
    00:41:11,222And I think, just by looking sometimes it's hard to tell.
    00:41:16,180This fire one, could be promising.
    00:41:21,208You know, and you can try different ones, too.
    00:41:24,309I think the one I like is this stupal one,
    00:41:27,444and the reason is it kind of has these build in,
    00:41:30,117I know it's kinda hard to see on the screen capture.
    00:41:33,213But it's kinda got these built in wavy structures to it
    00:41:37,949that really help it feel like liquid.
    00:41:40,182So, what I wanna do is, I wanna get rid of everything
    00:41:43,350that's not really, really white on this noise.
    00:41:48,100So, I'm gonna come down here, in this section here,
    00:41:50,155the low clip, and high clip.
    00:41:51,652This is kind of like controlling the contrast.
    00:41:54,308There is a contrast control as well,
    00:41:57,841but low clip just let's you control the blacks.
    00:42:00,566And you can see as I adjust it, make it higher,
    00:42:03,908and higher and higher,
    00:42:06,003you can see up here in the preview it's getting rid of
    00:42:08,901more and more, and it's just leaving
    00:42:11,316these little white areas.
    00:42:13,129And even just by doing that,
    00:42:14,293I'm starting to get some foamy stuff, okay,
    00:42:16,949which is cool.
    00:42:18,297So, the foam looks a little bit big to me,
    00:42:23,151so I wanna turn the global scale down a little bit,
    00:42:26,517maybe to 50, there we go.
    00:42:30,198And I'd want it to be a little bit brighter, too.
    00:42:33,459So, I can bring the high clip down,
    00:42:37,253and I'll get more white out of it.
    00:42:40,914Okay, and you can see now, you're kind of getting
    00:42:43,178these little foamy elements
    00:42:44,560on the surface of the water, too.
    00:42:46,545Right now they're evenly distributed everywhere,
    00:42:49,318so while if you look at one little piece of this
    00:42:52,745it looks great, overall it looks weird.
    00:42:55,299Water really shouldn't be like that.
    00:42:57,852So, and on top of that, you can see that
    00:43:01,058we've lost all oft he nice color and detail underneath,
    00:43:04,657because this noise effect, it needs to be
    00:43:08,436screened over the color, so I'm gonna change this to screen.
    00:43:13,045So, now we're getting our Fresnel, and we're getting that
    00:43:17,284all in one shader, all right, so again
    00:43:20,795the power of the layer shader.
    00:43:22,466So, now I'm going to show you guys a really cool trick.
    00:43:24,669I don't want this foam everywhere.
    00:43:28,039I want little patches of it.
    00:43:30,104So, now how the heck do we do that?
    00:43:32,469That's actually trickier
    00:43:34,308so, what I would do in Photoshop is I would
    00:43:38,175have the foam on a layer, and that layer
    00:43:42,006would have a mat.
    00:43:43,922It would have another black and white image
    00:43:46,162that's controlling the transparency
    00:43:47,904where it's showing through.
    00:43:49,524You can actually do that in the layer shader.
    00:43:52,164So, let's grab another noise shader, all right,
    00:43:57,575and let's turn the contrast way up,
    00:44:01,023so I can actually just kind of visualize
    00:44:03,124what we're gonna be able to use for a mat.
    00:44:06,526Because, what we're going to do here is create a mat.
    00:44:08,755Now, if I use this as a mat, this might actually work
    00:44:12,422fairly well, but I'd like to try to have bigger sections
    00:44:19,692of foam and no foam.
    00:44:22,729So let's turn the global scale up, maybe like 300.
    00:44:30,266All right, something like this might actually work,
    00:44:33,260because over here you'd have a big area with no foam.
    00:44:35,200And here you'd have a big area with foam.
    00:44:36,677Now, I don't want these hard edges,
    00:44:38,419because that's gonna kinda look weird, too.
    00:44:40,840So, I'm gonna turn the contrast down a little bit,
    00:44:44,730and now I'm gonna get a nice, soft, result.
    00:44:49,687So now, how do we use this noise texture as a mat
    00:44:53,275for our foam noise?
    00:44:55,446All right, let's go back to the layer shader
    00:44:57,447and let's name these layers so we can identify them.
    00:45:01,314So, this is gonna be our foam.
    00:45:04,077And then this one we must created is gonna be our mat.
    00:45:08,082So, you can actually use a mat in this layer shader.
    00:45:10,984And the way you do that, it feels a little backwards to me,
    00:45:14,441but the way it works is the mat layer actually goes
    00:45:18,727underneath the layer it's going to mat out, okay.
    00:45:22,374So, we set that from normal, to layer mask,
    00:45:27,724which is the very bottom option.
    00:45:29,387And you can see up here in the preview,
    00:45:33,171that it's actually cut out the layer
    00:45:35,076that's directly above it.
    00:45:36,074So, we're only getting noise in these few areas, all right.
    00:45:38,918And if we do a quick test render,
    00:45:40,370you can see there's noise here, there's foam here,
    00:45:43,110there's foam here, but there's not really
    00:45:45,175any foam over here, there's a little bit.
    00:45:47,196And it just kind of breaks it up, all right.
    00:45:49,595And if I turn this off show you guys again.
    00:45:53,880Here is where that foam appears everywhere.
    00:45:57,225And it kind of ends up looking, almost like a,
    00:46:00,676I don't know, it looks like a bad fabric or something.
    00:46:04,739And then when you turn this back on,
    00:46:07,590the layer mask, and turn it on, then now it breaks it up.
    00:46:11,946All right, and it's just a little bit more natural.
    00:46:13,895So, this is where I'm going to leave the texture.
    00:46:16,262This is not bad.
    00:46:17,429And I think if you started, if you did a render with this,
    00:46:20,071you would start to notice some of the sin,
    00:46:23,234but it's a good start.
    00:46:25,916And now that you guys understand how you can build
    00:46:27,851really complicated layer based shaders like this,
    00:46:32,714you could figure out how to do this exact thing
    00:46:36,223in the bump channel, in the diffusion channel,
    00:46:38,454you could even do it in the reflection channel.
    00:46:41,096So, you can do a lot of things
    00:46:43,621to get your textures to feel good.
    00:46:44,894The next thing I want to show you guys
    00:46:47,301is how you get this type to float on the surface of this.
    00:46:51,015All right, so let's, I'm gonna just put
    00:46:54,070a little protection tag on this camera,
    00:46:56,518so we don't move it because I like where it is.
    00:46:57,971All right, so first things first,
    00:47:00,200let's position this word in the ocean.
    00:47:03,602So, let's take this object, let's just move it down
    00:47:07,468so it's actually in the ocean,
    00:47:09,495ad let's rotate it, so it's kind of lying on the back.
    00:47:14,073All right, cool, so we like that.
    00:47:16,576Now, obviously if I hit play,
    00:47:18,822this is what's going to happen,
    00:47:20,262and that's not going to work very well.
    00:47:22,723So, how can we get this onto the surface?
    00:47:26,069Well, there is a pretty easy way that I've figured out.
    00:47:29,526So, the first thing we're gonna do is hide this.
    00:47:33,112I'm gonna create a new null,
    00:47:34,994and I'm gonna call this float null, okay.
    00:47:39,348Now, this null right now is just floating in midair.
    00:47:43,829I'm gonna put a tag on it, so I'm gonna control click,
    00:47:46,755and add a character tag, and the character tag I want
    00:47:50,691is constraint.
    00:47:52,903Now, the constraint tag, it basically attaches
    00:47:55,671two objects together, and it gives you
    00:47:57,862a bunch of different ways to attach them together,
    00:48:00,258and, you know, I'm not going to go over every single one,
    00:48:04,101but once you learn how to do this one way,
    00:48:08,232you'll be able to figure out
    00:48:09,703what the rest of these options do.
    00:48:11,299So, in this constraint tag, we're going to activate
    00:48:14,535the clamp option, and clamp actually just means
    00:48:18,840it's going to restrict one object's motion,
    00:48:21,708based on another object.
    00:48:24,116So, when you add a constraint, like a clamp constraint,
    00:48:28,151you have to tell the tag which object to clamp
    00:48:32,204the current object to.
    00:48:34,390So, the float null has the tag.
    00:48:36,105It's going to be clamped to whatever object I drag
    00:48:39,441into this target box here.
    00:48:41,526And you can have multiple targets, okay,
    00:48:43,540and sometimes you want that.
    00:48:44,840In this case, we just want one target.
    00:48:47,383And that target is going to be our plane.
    00:48:50,887And now you can see why it's very important
    00:48:53,060that we didn't use a displacement texture,
    00:48:55,798because we actually need to drag this geometry
    00:48:59,383down into this target box,
    00:49:00,804and it will use this displacement to calculate
    00:49:05,030where the surface of this thing is.
    00:49:07,672So, the next step is, we have a target,
    00:49:11,735and we have to change a couple of settings on it, okay.
    00:49:15,734So, the first setting is how do we wanna clamp
    00:49:18,741this float null to this plane up here?
    00:49:22,491Do we want to clamp it to the origin of the plane,
    00:49:24,566or something else?
    00:49:25,738If you click on this box here, it gives you
    00:49:27,971a bunch of options.
    00:49:29,225And we wanna clamp it to the surface of that plane.
    00:49:33,065Okay, so click surface, and you see
    00:49:36,396as soon as I did that the null jumped
    00:49:38,536and is now on the surface of this ocean.
    00:49:42,356And what's cool is if I switch to move tool,
    00:49:45,338and I move this null around,
    00:49:47,139it's a little bit hard to see here,
    00:49:48,775but you can see it actually follows the contour,
    00:49:51,539and stays always on the surface.
    00:49:54,871It's impossible for me to lift it off.
    00:49:57,158But I can move it this way,
    00:49:58,946and I can move it this way.
    00:50:00,231And it will follow the surface, okay, so perfect.
    00:50:03,016And what's even better is as this thing moves,
    00:50:06,551this thing will move up and down with it, all right?
    00:50:10,040Now, you're probably starting to see
    00:50:11,693how this is gonna work, right?
    00:50:14,457So, that's part one.
    00:50:15,456Just to show you what will happen now, if I,
    00:50:16,987let me unhide my type object.
    00:50:19,798And I'm gonna move the float null right over it, okay.
    00:50:26,207And let's position this thing kinda where we want it.
    00:50:31,300And then I'm going to parent the type under the float null.
    00:50:35,007And if we hit play, it's floating, okay, pretty awesome.
    00:50:40,763It doesn't look that realistic, because all it's doing
    00:50:44,036is floating up and down.
    00:50:46,164It's not rotating at all.
    00:50:47,172And we want really want it to kind of bob up and down,
    00:50:51,269like a real, like a boat would.
    00:50:54,914So, we have to do one more thing, all right.
    00:50:58,146This float null, right now all it's doing is
    00:51:01,764adjusting its position.
    00:51:03,763It's not adjusting its orientation.
    00:51:05,610So, I wanna turn that on.
    00:51:07,178I'm going to go back into the constraint tag,
    00:51:09,219and the second set of options down here
    00:51:11,822where it says, align.
    00:51:13,609So, the first option is which axis are we aligning to,
    00:51:16,594and I want to align to the Y axis, all right,
    00:51:18,563that's correct.
    00:51:20,367Now, how do I want to align?
    00:51:23,455For something like this, you wanna use what's called
    00:51:26,853the normal.
    00:51:28,959Now, think of the normal as the direction
    00:51:32,053that a polygon is facing from a model.
    00:51:36,656Okay, so, because this ocean is being distorted,
    00:51:40,427you can see this polygon right here is pointed
    00:51:46,455a little bit off to the right.
    00:51:48,820It's at a little bit of an angle.
    00:51:50,216It's mostly up and down, but not totally up and down.
    00:51:53,415And that angle is the normal.
    00:51:56,374Okay, I'm not really sure why it's called the normal,
    00:51:58,704but that's what it's called.
    00:51:59,985So, now if I look at the float null,
    00:52:04,150when we play it, you can see
    00:52:06,301that it actually is orienting appropriately, okay.
    00:52:11,467So, let's turn this back on and take a look.
    00:52:15,969I mean, that's the basics of it (laughs) right there.
    00:52:19,339That's kind of how it works.
    00:52:21,057So now, just to show you guys one thing that can happen
    00:52:27,466when you do this, what I'm going to do
    00:52:29,760is I'm going to go into displacer, and I'm going to turn
    00:52:34,664the global scale down a little bit.
    00:52:37,612And I'm going to turn the height up a little bit.
    00:52:43,418Okay, all right, so now it's still working, okay.
    00:52:49,142But, you can see that it's kind of doing some weird stuff
    00:52:52,009and it's a little bit jerky in points.
    00:52:54,273Right, so what's happening is this null is right here.
    00:52:56,108But when you have a very turbulent surface,
    00:53:00,810points that are very close together
    00:53:03,580might actually be very different heights.
    00:53:06,555So, like in this case here, when we get to this frame,
    00:53:11,584let me scoot the camera around here.
    00:53:13,464So, our null is kinda here,
    00:53:15,160but then on the right side of our object,
    00:53:17,770the ocean is higher there.
    00:53:20,635So, how can we kinda compensate, for a more turbulent
    00:53:26,013ocean like this?
    00:53:27,594Well, there's actually a pretty cool way.
    00:53:29,578So the first thing that I'm gonna do is take my object
    00:53:31,946out of this null and turn it off.
    00:53:34,827So, what I like to do is get one null set up
    00:53:41,974and then just copy it, and move the copy over a little bit,
    00:53:49,270move the copy over a little bit,
    00:53:51,078move the copy over a little bit, and you end up with
    00:53:52,915a few different nulls, right,
    00:53:56,393that are all on the same surface, okay.
    00:54:00,775And what you can then do, is take this object
    00:54:04,408and I'm going to hit option G.
    00:54:08,740Option G, whatever object is selected it groups it
    00:54:11,828under a null, and it puts the null
    00:54:14,681in the exact same spot as the object.
    00:54:17,122It's a very handy thing to do sometimes.
    00:54:19,281So, now I'm gonna call this float null main.
    00:54:24,838And what I wanna do is put a constraint tag
    00:54:27,287on this null, have it look at these four nulls
    00:54:30,631and kind of average the position out,
    00:54:32,563and the rotation out.
    00:54:33,790So, the way we're gonna do that is
    00:54:36,102we're gonna add constraint tag.
    00:54:39,897So, character, constraint.
    00:54:43,174That's not a constraint tag.
    00:54:44,774Let's try that again.
    00:54:47,850Okay, now this time instead of the clamp,
    00:54:51,964we could use this constraint.
    00:54:54,586It's called the PSR constraint.
    00:54:56,710And I'll just show you what it looks like.
    00:54:58,581PSR it lets you constrain one object's position,
    00:55:04,235scale, rotation, or just some combination of those three
    00:55:08,727to another object.
    00:55:10,133And if you add multiple targets to this,
    00:55:12,536it will average out the PSR of all those objects.
    00:55:16,542So, it's pretty cool, it's pretty handy.
    00:55:18,745In this case, if we do that,
    00:55:20,313it's gonna give us a pretty jerky feeling animation.
    00:55:23,577So, what we need to do is actually not use PSR.
    00:55:32,227We're gonna use a variation of PSR, called spring.
    00:55:36,486So, spring, it kind of works the same way.
    00:55:39,143It take the position scale rotation of one or more objects,
    00:55:43,361averages them out, and then applies that
    00:55:45,356to whatever object has the tag on it.
    00:55:47,689However, it does it in kind of a springy way.
    00:55:50,397It's a little bit looser,
    00:55:51,569and you can control that looseness.
    00:55:53,554So, with this float null selected,
    00:55:56,060I'm in the constraint tag.
    00:55:57,630I'm going to add, there's already one target setup, right,
    00:56:02,773so I'm going to add my first null, and you can see
    00:56:07,428that what it did is it set the length here pretty high.
    00:56:10,918It figures out how far away these two nulls are
    00:56:14,170and it assumes I want to keep them that far apart,
    00:56:17,076and that's not what I want.
    00:56:18,202I actually want them as close together as possible.
    00:56:20,571So, I'm gonna change this length to zero.
    00:56:23,113And I'm gonna check position, and rotation,
    00:56:26,678and then I'm gonna add three more targets,
    00:56:33,352and I'm gonna just, one by one,
    00:56:35,385add all of these nulls to those targets,
    00:56:40,134set their lengths to zero, and activate position
    00:56:44,720and rotation.
    00:56:47,758And if we hit play now, it's gonna kinda settle at first,
    00:56:53,299all right, and once it settles, you can see that now.
    00:56:57,803And actually, this'll probably work a lot better
    00:56:59,672if I position this thing in the ocean.
    00:57:02,281It's gonna take the average of those four nulls.
    00:57:06,186And you can see the nulls are here,
    00:57:08,648one, two, three, four.
    00:57:10,730So, you kinda wanna position your type around that.
    00:57:13,077Because that's where it's kinda measuring
    00:57:15,050how high the ocean is.
    00:57:17,707Okay, and you can see that now it's actually
    00:57:20,365kind of taken average of those nulls,
    00:57:23,082and so this moves a little bit smoother,
    00:57:25,288and it kind of smooths out the motion of it.
    00:57:30,663Right, so here's where we've ended up.
    00:57:32,485We've got our float object, and it's sort of constrained
    00:57:38,462to a bunch of different nulls.
    00:57:39,986And it's kind of getting the average
    00:57:41,436of all their positions, and rotations,
    00:57:43,434and it's using that information to smooth out,
    00:57:46,859and just kind of float on the surface.
    00:57:49,966And right now it's kind of going, you know,
    00:57:53,059up and down, and it bounces a little bit,
    00:57:54,475and it really is a pretty natural animation.
    00:57:56,600Now, you're noticing every time the animation resets,
    00:57:59,486this jumps, right, back into position.
    00:58:02,972That's because it's set up as a spring.
    00:58:05,709So, what you actually need to do
    00:58:07,339is go to the first few frames,
    00:58:09,673and I'm using the F and G keys
    00:58:12,804to go one frame forward and back.
    00:58:14,433And just kinda go back and forth,
    00:58:16,906because what happens is you go back and forth,
    00:58:18,973Cinema is running this spring simulation, right.
    00:58:23,042And once you get, once it settles,
    00:58:26,333go back to frame zero, frame by frame, and then set
    00:58:31,593key frames on this float null main.
    00:58:35,424I just hit F9 and set position scale rotation key frames.
    00:58:41,260And now when I hit play, it starts in the right position.
    00:58:45,230And you can see that it's actually started
    00:58:48,265a little bit high, so I'll have to adjust that.
    00:58:51,153But, now when it goes back, when you start it at frame zero
    00:58:55,486it'll start in the right position.
    00:58:58,203These things are a little finicky,
    00:58:59,724but a lot of times, and this works with dynamics as well,
    00:59:04,936you have to set a key frame on the first frame
    00:59:07,407of your animation to make sure
    00:59:09,404things begin in the right place.
    00:59:11,055So, anyway, so there you go.
    00:59:14,897We've got a floating type.
    00:59:16,716You've got a rippling ocean.
    00:59:19,981And you know how to begin the journey
    00:59:22,895of coming up with a really good ocean shader.
    00:59:27,019And when you put all of those things together,
    00:59:29,805You can get a really, really cool animation.
    00:59:33,102And you could even put the camera in this rig
    00:59:38,443and have it feel like the camera
    00:59:40,556is floating on the surface of the ocean.
    00:59:41,752There's a lot of things you could do with this,
    00:59:42,945and the constraint tag is very, very powerful.
    00:59:46,616There's other uses for it, but this is a great one.
    00:59:49,553So, there you go, thank you guys so much,
    00:59:51,070and I will talk to you soon.
    00:59:53,756Thanks so much for watching.
    00:59:54,987I hope you learned some new things in Cinema 4D today.
    00:59:57,757From how to create custom shaders,
    00:59:59,757to a new way of rigging something
    01:00:01,791that you may not have thought of before.
    01:00:03,248And if you have any questions, or thoughts,
    01:00:05,004let us know, and we'd love to hear from you.
    01:00:07,036if you use any of these techniques on a project.
    01:00:09,773So, give us a shout on Twitter @schoolofmotion
    01:00:12,634and show us your work.
    01:00:14,039And if you learned something valuable from this video,
    01:00:16,093please share it around.
    01:00:17,545It really helps us spread the word
    01:00:19,101about School of Motion, and we truly appreciate it.
    01:00:22,012Don't forget to sign up for our free student account
    01:00:24,495to access project files from the lesson
    01:00:26,601that you've just watched, plus a whole bunch
    01:00:28,620of other cool stuff.
    01:00:29,666Thanks again, and I'll see you next time.
    01:00:32,987(playful music)