Fading out edges of the terrain


How would one go about making a terrain that has edges which fade out to either some color or transparency. For example , if the terrain dim is 1000,1000,1000, and some “fading setting” is, say 20.0f, then fading of the edges would start and 980, and by the time it hits 1000 they would blend into a specific color or fade away completely (basically a lerp from 980 to 1000).

Do I need to write a custom shader for this or is there some material trick to accomplish this ?


I planned to use fog or lighting to accomplish a similar effect, hopefully it will work when I get to that point. I intend to have a collision field around my map and then a gradual fade beyond that.

Doing it with materials sounds complicated, but I’d love to see how it works either way because I’ll need it too later on!

By fading out the edges of the terrain do you mean zeroing the height at the edges?

Edit: For what I said above, use a macro called Zero Edges + WM2 (if you can’t just use photoshop) So when edges are zeroed your terrains blend together without issues.

For blending colors together you can just use the paint tool to paint on the edges. Like painting textures on UV seams of a 3D model.

Actually what I m trying to do is not flatten the terrain but just fade the colors near the X-Y edges. Something like in the picture here. I guess i could paint that but that seems like a lot of work - there must be some automated way to do this. I looked a bit at the fog as vanilla suggested but atmospheric fog seems to always be related to the distance from the camera, so it always fogs from the center of my view in all direction regardless of whether I m close to the edges or not.


To fade out the colors (desaturate them) around the edges of your landscape simply create a square mask where it’s all black and has a gradient to white towards the edges. You can then use the mask with a UV input with a size exactly like the landscape size (for example if map is 4019x4019 then LandscapeCoods node should also be set to 4019. You have the mask then, just apply a desaturate node and use the mask to tell it where to desaturate.

I’ll try that - thanks!

It may be a good idea to try something with lighting as well in case there are objects out there. It kind of reminds me of the effect you’d see in Warcraft 3 or Starcraft 2 at the edges of the map or where the fog of war kicks in.