Props and Fade Distances

- By Raeven0
This tutorial was last updated on Apr 20, 2005.

Watch the barrel:









The barrel faded out the further I got from it! Why?

The answer lies in these properties of all props:

"Start Fade Dist" [fademindist(float)]
"End Fade Dist" [fademaxdist(float)]

If a player is within the distance from the prop specified by Start Fade Dist, the prop will be fully visible. Look at the first screenshot again; I had to have been standing less than 128 units from the barrel, because the fully-visible barrel's Start Fade Dist was 128. If I had been further from the barrel than its Start Fade Dist, then the barrel would not have been completely opaque.

Now, if a player is further than End Fade Dist from the prop, then the prop will not be rendered at all. Take a look at my last screenshot; I had to be further from the prop than its End Fade Dist, because it was completely invisible.

If the Start Fade Dist and End Fade Dist are not equal, then the prop will fade out as you move from the former distance to the latter. The middle two screenshots are an example of this: I must have been standing somewhere between the barrel's Start Fade Dist and End Fade Dist, because the prop was only partly visible.

Interesting tweak for Start Fade Dist: if it's set to a negative number, it will be the same size as the End Fade Dist. So, if you don't want a prop to fade out--if you just want it to abruptly disappear--don't worry about setting the Start Fade Dist; just set the End Fade Dist, and the Start Fade Dist will assume its partner's value automatically.

And, if you don't want the prop to fade at all, simply set its End Fade Dist to 0. This disables all fading over distance.

Using a prop's fade distances, you could set its Start Fade Dist to -1, its End Fade Dist to 1024, and have fog that stops all visibility beyond 1024 units. This means that at the same time the fog obscures the prop, it will also become invisible, saving the engine some work because props would normally tax the engine whether fog obscured them or not!

But wait! There's more!

Prop_static entities also support a Screen Space Fade (just set that property to Yes and it'll be activated). If Screen Space Fade is enabled, the prop's Start Fade Dist and End Fade Dist won't represent distances; rather, they'll represent pixels. You can have the prop disappear if it's smaller than 16 pixels onscreen, for instance. The setup of the properties is exactly the same, except that they correspond to size and not distance.

But wait! There's even more!

The worldspawn (Map --> Map Properties) can specify fade distances as well. These will override the set fade distances in prop_static ONLY. Other props will not be affected.

And there's one last thing.

- "Fade Scale" [fadescale(float)]

The Fade Scale gives you additional control over props' fade distances if you do not specify the fade distances within the prop (see above paragraph). If the worldspawn does specify fade distances, or if the engine is running below DirectX7, then the props will be faded out forcibly. The Fade Scale gives you some control over this: it's inversely related to the prop's fade distances; that is, smaller numbers cause the prop to fade at further distances, and larger numbers cause the prop to fade at smaller distances.

Huzzah!



Still need help? Ask your questions in one of our HELP FORUMS
Post A Comment
Name:
Email: Links Not Allowed In Comments
Comment:
What is the capital of France? Need Help?
All original content ©2006 EditLife.net. All Rights reserved. All files property of their rightful owners.
Get Firefox! Get Thunderbird! Get Notepad++!