From: Brian P. <br...@va...> - 2000-10-27 22:39:33
|
Michael Vance wrote: > > On Fri, Oct 27, 2000 at 12:46:32PM -0600, Keith Whitwell wrote: > > > Not really. The FX driver basically turns this code off as the hardware > > normally fogs from the z or 1/w values (I can't remember which). I'm sure > > it's just a matter of setting up the fog table correctly for orthographic > > projections & making sure that some usable value gets into the vertex format. > > The w-value is always 1 (or 0, can't remember) for vertices in an > orthographic projection, and the 3Dfx card uses the w-value for > indexing into the fog table--thus everything is fogged with the fog > color from entry 1 (or 0). > > In the past, Brian and Daryll mentioned using an alternatve fogging > method available in Glide3 (a z fogging method), but I don't believe > it was pursued. In glide.h we see this: typedef FxI32 GrFogMode_t; #define GR_FOG_DISABLE 0x0 #define GR_FOG_WITH_TABLE_ON_FOGCOORD_EXT 0x1 #define GR_FOG_WITH_TABLE_ON_Q 0x2 #define GR_FOG_WITH_TABLE_ON_W GR_FOG_WITH_TABLE_ON_Q #define GR_FOG_WITH_ITERATED_Z 0x3 #define GR_FOG_WITH_ITERATED_ALPHA_EXT 0x4 #define GR_FOG_MULT2 0x100 #define GR_FOG_ADD2 0x200 So using GR_FOG_WITH_TABLE_ON_Q or GR_FOG_WITH_TABLE_ON_W is the same and neither works with orthographic projection since the W value is always 1.0. I'm thinking that if we're using orthographic projection that we could use GR_FOG_WITH_TABLE_ON_FOGCOORD_EXT (available on Voodoo3 and later, don't know about Banshee or Voodoo1/2) if we added a fog coord to the Glide vertices and computed it from the vertex Z somewhere in the vertex setup code. I think this would be much more easily done in the new tdfx-3-0-0 driver than the current driver. Gareth, could we put GR_FOG_COORD into the vertex struct where we currently have a GLuint padding? I haven't examined the vertex layouts very much yet. I can't find any documentation for GR_FOG_WITH_ITERATED_Z but I'd guess that f (fog factor) is just a multiple of the fragment's Z and can only be used for GL_LINEAR fog if near=0 and far=1. -Brian |