Archive:

Subscribe:Atom Feed

"Mud Treatment"

Posted: 29 April, 2022

25-29.04.2022

The whole week’s been spent on one thing: taking last week’s blockout and looking for the visual style. I went into it knowing vaguely what I wanted: Rain on muddy ground, with a vague hint of the Dead Marshes, from LotR. But without the ghosts and dead bodies.

I’ve never done wet or rainy before, so I wasn’t sure if I’d be able to pull it off. To complicate things, the entire effect needs to blend in and out, as the player moves in and out of the location.

Here’s a quick break down.

Ground

There’re three parts to this:

The first thing I did was create a new texture in Substance Designer. It’s using the same base as the floor from the first dungeon. I’ve added more stones, of various sizes, and darkened the colour gradient.

I faffed about for a while with a height map and various inputs before I discovered that Designer has a water level node, and er, yeah. That helps!

Each part of the environment uses a texture that’s derived from this single base. For the mud, I remove the stones and raise the water level. For the ground, I lower the water level and remove the larger stones.

The modular pieces are the same, 1m high pieces, that I’ve been using throughout the game. Except I’ve removed the little poly overhangs for the grass edges.

I removed these using the new modelling plugin, in the UE5 editor, which I must admit I was sceptical about, but now I get it. It’s perfect for tweaks like this.

Fluid Ninja

The sim for the mud is moved in world space, and mapped onto a static plane. It’s basically the same as one of the world space examples. It works well, but the velocity damping is broken. Static objects shouldn’t be contributing to the world sim.

I probably need to edge the specular down a bit. I ramped it up so I could see it, and it’s a bit much for mud.

Rain

I kinda knew how to do the rain. The ripples are a sine, animated over a radial gradient. The trick I’d never used – using a grey scale texture as an additive “mask” to Time – I picked up from Ben Cloward’s shader tutorial

He’s done a load of good stuff, btw. I dip into his tutorials quite often.

Also discovered another material node: BlendAngleCorrectedNormals, for merging two normal maps. Turns out I’ve been doing this wrong, for years.

Anyway. My rain is in a material function that I can drop into master materials. I’ve now got wet variations for props, env and the player.

The ground materials in this location have visible puddles. To limit the ripples to those areas, I’m taking the roughness value from the texture and putting it through a step. This gives me a mask I can use before combining the normals.

The falling rain is a Niagara particle system. The system, like the Fluid Ninja sim, follows the player in world space and fires particles out. They’re tilted, slightly, like everything else in the world.

Blending

Every map location has its own post processing volume, each with slightly different colour grades. Some locations, like Ytene, go further and blend between lighting curves, so the Sun/Moon and Skylight contributions can be different intensity and colours between locations.

This has been working for a long while, but I’ve never exposed the current/calculated blend-weight of each location globally. So that was a simple change to make.

With that done, I created a Material Parameter Collection containing a couple of scalars, that are plugged into the rain’s material function. At zero, the material function’s not generating anything, at 10, it’s making really visible bumps. The MPC’s a global lever that affects all the materials that use the function.

I added an actor to the level that polls the region’s blend weight and sets the scalars. Bingo, the rain fades in and out as the player walks in and out of the location. The Niagara System does the same; uses the blend rate to scale the system's spawn rate.

It’s super simple.

But now I have dynamic rain, so I might go further and tie it to ToD, or maybe an in-game event.

Light

I wanted to have visible shadows on the ground, from clouds, and I toyed with a couple of ways of doing it. My first thought was to have a world position noise texture, just above the camera, and let the directional lights cast a shadow through the alpha mask, but then I decided to plug this into the light’s material function, instead.

And I really like it! It’s subtle. You walk through light and dark patches. In some places the directional light is clearly reflecting off the puddles, in others, it’s barely reflecting at all. It’s more like an April shower than a storm, and I think that kinda fits the area.

Unfortunately, the reflections are screen space, so I can’t really get clouds to reflect in the puddles. I did mess about with it for a bit, but I don’t think it’s that important.

Miscellaneous

I’ve added in some foliage, for movement and I still need to add in some lightning, and audio.

I think I’ll dress the rest of the area with roots and vines, and then I’m pretty much done with the look and feel. It came together quicker than I expected, which is a result!

Here’s where I’m at:

Previous Post: "Next Blockout"

Friends:

If you like any of my work, please consider checking out some of the fantastic games made by the following super talented people: