Tutorial: Seamless Skybox Fog Last edited 3 weeks ago2024-09-20 03:16:01 UTC

Here's the Trick

We've all seen stuff like this:
Doesn't exactly work does it?Doesn't exactly work does it?
This is caused by the fog not matching the skybox. We could make the horizon of the sky material a faded colour, but it isn't that customizable and you could only a single colour. Alternatively, you could make the sky a single solid colour, but that's tacky; we do like clouds after all. In past games on various platforms, geometry would slowly fade-in to remedy this problem, but again it is rather tacky.

So how do we fix this?

The geniuses at Valve came up with a great method, used to great extent in Left 4 Dead. The resources required for this is a skybox and two custom textures. This neat trick will work on any Source game or mod, so feel free to experiment.

Make the following materials:
Solid BlackSolid Black
Gradient BlackGradient Black
This is all you need. If you're mapping for Left 4 Dead, materials like these are already in the game.

Next, create your skybox as usual. Create a tube in it and texture it appropriately with your black fade texture on the inside. Use nodraw for the rest. Place a sky_camera in the bottom of it as well.
yupyup
Colour the bottom of the skybox black. You can adjust the height of the fade as needed. This is based on the height of your map and its features. Experiment and find a setting that fits your map.
meowmeow
So next we need to spiffy up the sky_camera entity to work for us properly. Make sure the Fog Enabled property is enabled and that the tube of black fade is just beyond the fog so it becomes a solid colour.
Sky CameraSky Camera
The above settings are extreme. If you want skybox elements like buildings and such, just add it in as usual.

The end result looks smooth and well blended:
SnazzySnazzy
Ideal for those zombie apocalypses or Combine overrun cities.

3 Comments

Commented 13 years ago2010-10-22 04:00:19 UTC Comment #100973
Wish i knew about this when i was making my compo entry. Would've made everything THAT much better.
This is nice and simple! Awesome Tut!
Commented 13 years ago2010-10-23 19:44:12 UTC Comment #100974
and you could only a single colour
Heh.
Commented 13 years ago2010-10-27 15:32:14 UTC Comment #100975
Source tutorials from Rimrook? HNNG!

Head explodes

You must log in to post a comment. You can login or register a new account.