Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ fogvertex(3G) — IRIX 6.5.3f

Media Vault

Software Library

Restoration Projects

Artifacts Sought



fogvertex(3G)                                                    fogvertex(3G)



NAME
     fogvertex - specify atmospheric fogging effects

C SPECIFICATION
     void fogvertex(long mode, float params[])

PARAMETERS
     mode     expects one of eight valid symbolic constants:

              FGVTXEXP:  FGPIXEXP:  interpret params as a specification
              for fog density and color.  These modes are suited to simulate
              heavy fog.

              FGVTXEXP2:  FGPIXEXP2:  interpret params as a specification
              for fog density and color.  These modes are suited to simulate
              distant haze.

              FGVTXLIN:  FGPIXLIN:  interpret params as a specification
              for eye space distance to start of fog, eye space distance at
              which fully fogged, and fog color.  These modes can be used as a
              more versatile alternative to depthcue:

              FGON:  enable the previously defined fog calculation.

              FGOFF:  disable fog calculations. (default)

     params   Expects an array of floats containing value settings.  For
              FGVTXEXP, FGPIXEXP, FGVTXEXP2, and FGPIXEXP2 four floats
              are expected.  They are density, red, green, and blue.  density
              specifies the (thickness) of the fog (or haze).  A value of 0.0
              results in no fog.  Increasing positive values result in fog of
              increasing density.  Values are normalized such that a density
              of 1.0 results in the fog becoming completely opaque at a
              distance of 1.0 in eye-coordinates.  For FGVTXLIN and
              FGPIXLIN five floats are expected.  They are eye space
              distance to start of fog, eye space distance at which fog is
              completely opaque, red, green, and blue.  The colors are
              specified in the range 0.0 through 1.0.  The specified contents
              of params are insignificant when mode is FGON, or FGOFF.

DESCRIPTION
     The effects of fog on shading are simulated by blending computed object
     colors into the specified fog color. shademodel is ignored during
     fogging.

     Calculation of the blend factor for:

     FGVTXEXP:

          fog = e ** (5.5*density*Zeye)
          fog is computed at each vertex of the primitive




                                                                        Page 1





fogvertex(3G)                                                    fogvertex(3G)



     FGPIXEXP:

          fog = e ** (5.5*density*Zeye)
          fog is computed at each pixel of the primitive


     FGVTXEXP2:

          fog = e ** (-5.5*(density*Zeye) ** 2)
          fog is computed at each vertex of the primitive


     FGPIXEXP2:

          fog = e ** (-5.5*(density*Zeye) ** 2)
          fog is computed at each pixel of the primitive


     FGVTXLIN:

          fog = (end_fog + Zeye)/(end_fog - start_fog)
          fog is computed at each vertex of the primitive


     FGPIXLIN:

          fog = (end_fog + Zeye)/(end_fog - start_fog)
          fog is computed at each pixel of the primitive


     Where:

     Zeye        is the Z coordinate in eye space (always negative).

     density     is the fog density.

     fog         is the computed fog blending factor, ranging from 0 to 1.

     start_fog   is the eye-space distance at which fog effect begins.

     end_fog     is the eye-space distance at which fog is opaque.

     The pixel color/fog color blend is done with the following equation:

          C = Cp*fog + Cf*(1.0-fog)


     Where:

     fog   is the computed fog blending factor, ranging from 0 to 1.





                                                                        Page 2





fogvertex(3G)                                                    fogvertex(3G)



     C     is the resulting color component (red, green, or blue).

     Cp    is the incoming pixel color, already either Gouraud or flat shaded,
           and textured.

     Cf    is the fog color component as specified by the fog definition

     Eye-coordinates exist between ModelView transformation and Projection
     transformation (see mmode).  This space is right-handed, so visible
     vertices always have negative Z coordinates.  Thus the fog equation
     always raises e to a negative power.

     In all cases (including ortho) the viewer is considered to be at location
     0,0,0, looking down the negative z axis.

SEE ALSO
     gRGBcolor, mmode

NOTES
     IRIS-4D G, GT, GTX, and the Personal Iris models do not support any fog
     options. IRIS Entry, Indy, XL, XS, XS24, XZ, Elan, Extreme, and VGX
     systems do not support the per pixel fog modes, FGPIXEXP, FGPIXEXP2,
     and FGPIXLIN, while the VGXT and SkyWriter support all fog options.
     Use getgdesc(GDFOGVERTEX) to determine whether fog support is available.

     Fog only works for mmode(MVIEWING).

     For FGPIXEXP, FGPIXEXP2, and FGPIXLIN, to maximize the accuracy of
     the fog, minimize the ratio of the distance to the far clipping plane
     over the distance to the near clipping plane.  In addition, maximize the
     lsetdepth range.

     The results of fog calculations are defined only while in RGB mode.






















                                                                        Page 3



Typewritten Software • bear@typewritten.org • Edmonds, WA 98026