Fog

New Message Reply Date view Thread view Subject view Author view

Ran Yakir (rany++at++bvr.co.il)
Thu, 10 Mar 1994 13:37:02 +0000


Hi All

I'm using spline fog on Performer 1.2, and have 2 questions

1. The spline fog doesn't work on every RealityEngine machine. Furthermore, on
our dual-headed ONYX, it works on the zeroth head but not on the other one. By
'doesn't work' I mean that you set the fog, but see no fog whatsoever.

2. Is it expensive to set the fog ranges and ramp each frame ? Is it better to
create several fogs and just switch between them when necesary ?

Here is the code fragement that generates the fog :

/*
 * init_fog() is called once at the beginning of time
 */
void init_fog (nrt_fog *fog)
{
        fog->is_fog = 0;

        fog->fog = pfNewFog (pfGetSharedArena());

        fog->fog_type = PFFOG_PIX_SPLINE;

        pfFogType (fog->fog, fog->fog_type);

        pfFogColor (fog->fog, 1.0, 1.0, 1.0);

        fog->onset_range = 20000.0;
        fog->opaque_range = 50000.0;
        pfFogRange (fog->fog, fog->onset_range, fog->opaque_range);

        pfGetFogRamp (fog->fog,
                                &fog->nof_points,
                                fog->ramp_range,
                                fog->ramp_density,
                                &fog->ramp_bias);
}

/*
 * update_env() is called each frame and updates the fog among other things
 */
void update_env (pfChannel *chan, nrt_environment *env)
{

        /*
         * do other things
         */
        ....

        /*
         * do fog
         */
        pfFogType (env->fog.fog, env->fog.fog_type);

        pfFogRange (env->fog.fog, env->fog.onset_range, env->fog.opaque_range);

        pfFogRamp (env->fog.fog,
                                env->fog.nof_points,
                                env->fog.ramp_range,
                                env->fog.ramp_density,
                                env->fog.ramp_bias);

        if (env->fog.is_fog)
                pfESkyFog (esky, PFES_GENERAL, env->fog.fog);
        else
                pfESkyFog (esky, PFES_GENERAL, NULL);

        pfChanESky (chan, esky);

        /*
         * do more other things
         */
        ....

}

Thanks

Ran Yakir

-- 
 __                                  | Ran Yakir
 /_)  _  __   \  / _   / o __        | Phone :
/ )_ (_(_) )   \/ (_(_/<_(_)(        |   Work : 972-3-5715671
              _/                     |   Res. : 972-3-6995364
                                     | E-mail : rany++at++bvr.co.il

New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:50:12 PDT

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