-----Original Message----- From: Brian Hook [mailto:bhook@verant.com] Sent: Wednesday, April 12, 2000 9:24 AM To: Algorithms List Subject: Re: [algorithms] What are 3d textures? Fog, itself, is a gross approximation in computer graphics. In "real life" fog consists of two key elements, absorption of light and also emission via scattering of incoming light. This is generally approximated by using a pure (a,1-a) blend, but this is not entirely accurate. Ideally you would perform a filter then an add operation to get more correct fogging, but this is generally impractical (or not worth the effort). In addition, the fog density of a fragment should be based, as you state, on an integration of the densities along a ray between the viewer and the fragment. Once again, this is approximated in the realm of computer graphics by the various fog density generation equations, or at best as a linear approximation based on the depth of a ray through a bank of fog. For my purposes, the above two approximations are generally "okay". They look okay in my application, but I combine volumetric fog with a range based fog so that the latter masks anomalies with the former. It looks pretty good. I don't believe that Q3 uses per-vertex fog anymore, but I'm not sure on this (I believe that changed after I left id). The biggest problem with my proposed technique is that you don't get true "volumes" of fog, i.e. wisps of fog floating in space, you only get the fog decaled onto any faces in the volume. Doh! Actually, come to think of it a 3D texture doesn't work for fog as I just stated for that very reason (I'm using 2D textures for volumetric fog, and just assumed my technique could extend to 3D...color me stupid). Because there is no integrated fog density, if a piece of geometry is in a "clear" section of the volume it won't appear fogged. Okay, discount that for fogging. However, I still stand by my comment on lighting using 3D textures, although that could appear to have similar problems if you don't have a monotonically varying light fall off (i.e. patches of black in your lighting). The typical case for this would be a 3D sphere of light with a proper fall off. Obviously, this will brighten things up quite well, but by itself it won't cast shadows, etc. Brian > -----Original Message----- > From: Tom Forsyth [mailto:tomf@muckyfoot.com] > > Doesn't the texture have to store cumulative fog densities, i.e. > the density > from the eye, through the fog, to where that texel is? That means > that every > time the viewer moves, you need to recalculate the whole texture. > Ugh. Might > as well do the Quake3-style per-vertex fog - just as much work, but less > texture to upload. > > If you just put the density in there, then looking through a fog bank at a > wall on the other side of the bank gives you a bright shiny wall, > not fogged > at all. >