Re: pfFog to glFog conversion

New Message Reply Date view Thread view Subject view Author view

Jean-Luc Dery (dery++at++discreet.com)
Fri, 20 Nov 1998 12:10:26 -0500


On Nov 20, 9:18am, Steve Baker wrote:
> Subject: Re: pfFog to glFog conversion
> On Thu, 19 Nov 1998, Jean-Luc Dery wrote:
>
> > Hi pfFriends,
> >
> > I'm trying to figger out how Performer converts fog parameters to OpenGL.
When
> > setting pfFog to one of the following types: PFFOG_VTX_EXP, PFFOG_VTX_EXP2,
> > PFFOG_PIX_EXP, PFFOG_PIX_EXP2, it should convert the opaque range and type
> > settings to an equivalent density value in order to set OpenGL density
> > parameter.

I reversed engineer using glGetFoat( GL_FOG_DENSITY, &density ) while setting
fog with pfFog. Here's what I've figured out.

PFFOG_VTX_EXP and PFFOG_PIX_EXP uses:
density = log( 1/512 ) / opaque_range;

PFFOG_VTX_EXP2 and PFFOG_PIX_EXP2 uses:
density = sqrt( log( 1/16384 ) ) / opaque_range;

I can understand the EXP types but not the EXP2 types.

We need to find the density for which saturation of color will appear for a
give opaque range. Starting with the premise that color are defined from 0 to
255 (2^8), color will become saturated at 245.5 -> (255-245.5)/256 = 1/512.
This makes sense to me.

As for EXP2, I don't really get it. It appears that in that case, colors are
defined from 0 to 8191 (2^13) and ,in which case, saturation occurs at 8190.5
-> (8191-8190.5)/8192 = 1/16384.

Anyway, those conversion function are working just fine for any given opaque
range in our system.

Jean-Luc

-- 
_____________________________________________________________________________

Jean-Luc Dery Discreet Logic Technical Leader 10 Duke Street 3-D Graphics Technology and Montreal (Quebec), Canada, H3C 2L7 Realtime Systems Tel: (514) 954-7239 Email: jean-lucD++at++discreet.com Fax: (514) 393-0110 _____________________________________________________________________________


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Fri Nov 20 1998 - 09:11:14 PST

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.