What is the advantage of using a Fog System in my game?

Adding fog to a 3-D scene can enhance realism, provide ambiance or set a mood. A Fog can also mask the effect of objects suddenly appearing as they come into the camera clipping plane. If a distance fog is set on your huge-terrain system it can increase your frame rate by helping the renderer to avoid distant objects. Fog is implemented by blending the color of objects in a scene with a chosen fog color based on the depth of an object in a scene or its distance from the viewpoint. As objects grow more distant, their original color blends more and more with the chosen fog color, creating the illusion that the object is being increasingly obscured by tiny particles floating in the scene. Direct3D supports two fog models, pixel fog (table fog) and vertex fog, each with its own features and programming interface. Pixel fog gets its name from the fact that it is calculated on a per-pixel basis in the device driver. Pixel fog is sometimes called table fog because some drivers use a precalculated lookup table to determine the fog factor, using the depth of each pixel to apply in blending computations. It can be applied using any fog formula identified by members of the D3DFOGMODE enumerated type. The implementations of these formulas are driver-specific. If a driver doesn't support a complex fog formula, it should degrade to a less complex formula.

Vertex fog is computed by the pipeline (Direct3D lighting and transformation engine) during transformation and lighting calculations. When the system performs vertex fogging, it applies fog calculations at each vertex in a polygon, and then interpolates the results across the face of the polygon during rasterization. If your application does not use Direct3D for transformation and lighting, the application must perform fog calculations. In this case, use range-based, volumetric or other formulas and place the fog factor that is computed in the alpha component of the specular color for each vertex.

FAQ Menu

 
Printer friendly version of the FAQ-DIRECTX-Advantages-of-Fog-System page


Sponsored links

Build IT Knowledge with Current & Trusted Content
Helps Employees Develop & Hone New Technical Programming Skills. Sign Up & Get Full Access.
Check Out IT Certification Preparation Materials
Sign Up With SkillSoft & Get Access to Training Materials for Over 50 Professional Certifications.
Six Sigma Certification
100% Online-Six Sigma Certificate from Villanova - Find Out More Now.
SSH and SFTP support for .NET
Add complete SSH and SFTP support to your .NET framework application
ASP.NET 3.5 Hosting on Windows 2008!
ASP.NET 3.5/2.0 Hosting on Windows 2008 & 2003! AJAX, LINQ, & Silverlight Ready! 3 Mo. Free!!

Advertisement



Free Magazine

Free Magazines
eWeek The essential technology information source for builders of e-business.... subscribe now

Newsletter | Submit Content | About | Advertising | Awards | Contact Us | Link to us |
© 1996-2008 Community Networks Ltd All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited. Violators of this policy may be subject to legal action. Please read Terms Of Use and Privacy Statement for more information. Development by Synchron Data - .NET development.