Michael Jones (mtj++at++babar)
Mon, 6 Jun 1994 16:20:46 -0700
:I need to explicitly set the fog density parameter of Performer fog. As far
as
:I can tell the only way to do this is with PFFOG_PIX_SPLINE, but what I'd
:actually like to do is use PFFOG_PIX_EXP or PFFOG_VTX_EXP.
No problem. To quote from the new IRIS Performer 1.2 Programming Guide:
"You can set the near and far edges of the fog with pfFogRange(). For
exponential fog functions, the near edge of fog is always zero in eye
coordinates. The near edge is where the onset of fog blending occurs,
and the far edge is where all pixels are 100% fog color."
:Basically I need the extra parameter that fogvertex(3G) uses for density, but
:in looking at the Performer documentation it's not clear how to do this
without
:going to the GL, which I'd like to avoid if possible.
The opaque distance is (in a sense) equivalent to the density. Since fog
density
is a function of distance, it's possible to define fog as a (density, distance)
pair. It was decided to use an implied density=1 in the IRIS Performer API
such that "at the opaque fog range, the fog density is 1.0". Given this, only
the distance need be specified.
If f = 1 - e**(-k*d), and you want to specify the general (f,d) pair, just
solve for the appropriate f=1 case and use the new d' in your IRIS Performer
calls. The only problem here is that you can't really solve for f=1 above
and need to accept 255/256th's or so.
:It appears that the only controls over fog, besides with the SPLINE type, are
:color and the near and far fog planes. Am I missing something obvious? How
:does Performer calculate the density parameter for fog by default?
The opaque and opaqueOffest parameters are used to define the density
in the fogvertex() command as shown in this code extract (from IRIS
Performer's fog application code):
switch (fog->type)
{
case PFFOG_VTX_LIN:
case PFFOG_PIX_LIN:
props[0] = fog->onset + fog->onsetOffset;
props[1] = fog->opaque + fog->opaqueOffset;
if (props[1] < props[0])
props[1] = props[0];
props[2] = fog->color[0];
props[3] = fog->color[1];
props[4] = fog->color[2];
break;
case PFFOG_VTX_EXP:
case PFFOG_PIX_EXP:
case PFFOG_VTX_EXP2:
case PFFOG_PIX_EXP2:
props[0] = 1.0f/(fog->opaque + fog->opaqueOffset);
props[1] = fog->color[0];
props[2] = fog->color[1];
props[3] = fog->color[2];
break;
--Be seeing you, Phone:415.390.1455 Fax:415.390.2658 M/S:9U-590 Michael T. Jones Silicon Graphics, Advanced Graphics Division mtj++at++sgi.com 2011 N. Shoreline Blvd., Mtn. View, CA 94039-7311
This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:50:19 PDT