[Wesley Martin] The Ocean shader is one of my...
it's probably my single favorite shader that Logan made for the game,
and it is very robust, and we use a lot of variants
for different things in the solar system.
I'll talk about the ocean first, because that was sort of the template
that when we were rebooting art, we used Giant's Deep as like a vertical slice,
and we were like, OK, we need to have cool looking water to sell the planet,
because that's most of what you see. And so we made the shader,
and then I was like, hey, what if we hijacked it, and did this with it?
And Logan was like, oh, it's a good idea.
And so we ended up using it all over the place.
The way the Ocean shader works is this sphere is technically a cube.
And it's hard to show because I would have to edit the shader code,
and I'm not a programmer, so I don't want to do that.
But essentially, the way it works is, there's
a cube that then gets projected into the shape of a sphere,
and that allows us to do heightmap stuff, which I said we couldn't
do because everything is on spheres.
But Logan created a clever workaround, where we take this cube
and snap it to a sphere. And so then we can tile
square textures along it to create this heightmap blend,
and I'll show you how we do that.
We have our Surface shader here,
which has got a lot of stuff going on.
It's got some standard shader stuff, like Color and Smoothness and all that.
But the ocean itself is made up of these four heightmaps.
And each one of the heightmaps is actually four heightmaps in one.
You can see RGBA here.
We use each of the four channels for a different grayscale heightmap.
And so we have different scales of them, essentially.
There's these really tiny waves that you can see on the surface.
There's big chunkier waves that create the patterns overall.
And essentially, each channel is faded one to the other over time.
It'll be red for a second and then green for a second,
then blue, then alpha, and then we'll loop back around.
And then meanwhile, we have control over how fast
these scroll across the surface, how much they Displace
the verts of the sphere, and like the time scale and some offset stuff
so that it doesn't look super repeated.
Another nice thing that makes the shader possible
is that it's called the tesselated sphere renderer, because it dynamically
tesselates based on how close the camera is.
Again, that's another thing that I can't really show
without editing the shader code.
But you'll just have to trust me that the ocean here is really high density.
There's a lot of polygons and triangles.
[Audience] Can you turn it into a Shaded Wireframe, so perhaps maybe...
[Wesley] It doesn't actually work because of the shader.
And I may have just... you can kind of see it.
[Audience] Oh, yeah, that's crazy to see.
[Wesley] Yeah, so you can see like over here:
there's like lower density on the triangles.
You can see like right there there's a seam where it transitions
from a higher poly to a lower poly.
That's how that works.
It's much easier to see with a gray scale.
All that Displacement happens on the high poly stuff that you're close to,
and then it has nice transitions, that there aren't seams.
And then there's also another heightmap here, which we call Chop,
and this is specifically used in conjunction with the Tornadoes.
You can see they sort of pull the ocean up into them.
That's basically a volume we have attached to the bottom of the Tornado.
And wherever that volume is, it adds the Chop pipe map;
in addition to the others.
And then we have the reverse, as well. For certain islands,
we have calm zones that basically make the waves lower.
[Audience] If we were to hide one of the Tornadoes,
would it better illustrate what that Chop looks like?
[Wesley] Yeah, I can just, I'll show the Tornadoes more in a moment,
but I can quickly do that
if I just turn off these meshes,
turn off the Tornado_Top.
It's not turning off.
That's because I need to turn off the Skinned Mesh.
There we go. You can see it's pulling the waves up.
And if I grab the Ocean Chop Zone, and move it around,
that's what the Tornadoes are doing is they're moving around.
And then in addition to all that, the ocean also
has Foam, which you can see on the Chop here,
which is basically whenever the height gets above a certain level,
we add this sort of white texture to it so that it becomes more opaque.
And it doesn't look very good with the lighting off,
but you can see that it gets closer to the top there.
[Audience] Yeah, it makes it more clear.
You just see the black and white through the foam.
[Wesley] Yep. So that...
that's a lot of the ocean shader.
See if there's anything else I missed here.
it also it uses other water stuff, so it has refraction.
And if you look at something close,
you can see that it's refracting the stuff under the water.
It's kind of hard to tell. Maybe if I grab this light...
and make it really bright,
you can see underneath the water it's refracting,
like you would expect.
In addition to all the other fancy things it does, it also is water.
And something that we took the effort to do, which a lot of games try and avoid,
is we actually have a stencil so you can see both above and below the water
at the same time.
A lot of games, you just like pop the camera
one way or the other because it's a hard thing to handle. But,
since Outer Wildes is so much about naturalism and like the feeling
that you're actually there in your suit,
we wanted to handle that so that you could feel like you're
bobbing up and down in the water.
[Audience] And how is the effect of being underwater achieved?
Just that is that another kind of fog or you say the system as a fog?
[Wesley] The underwater shader is probably
more similar to a lot of underwater in video games.
It's like a shader that renders fog and distorts things above the surface.
We had to make it in the shape of a sphere, which was a challenge.
But in other ways, it's more typical,
like what you'd see in a normal video game.
[Audience] And the sphere is rendered on two sides
so you could see it from the bottom, as well?
[Wesley] The ocean surface, we have it.
When you're looking up, it also refracts above the water.