Re: zbuffer/fog problems

New Message Reply Date view Thread view Subject view Author view

Rob Jenkins (robj++at++sgi.com)
Mon, 21 Jun 1999 15:07:23 +0100


A comment about the fog quality mentioned on IMPACT: the res of fog you
see is dependant on HW implementation rather than the number of zbits
you have, Impact has one table for all it's fog info, iR has 1 coarse
and one fine res table, and uses a more complex ( so expensive )
calculation.

Cheers
Rob
  

Javier Abadia Miranda wrote:
>
> Nils Lande wrote:
> >
> > Hi,
> >
>
> > The sky dome consistes of a pfGeoSet with a pfGeoState which is
> > attached to the scene graph. If I didn't need to worry about the sky dome I
> > could move the far clip-plane closer (far =15-20 000). Could I somehow draw
> > the sky geoset in a draw callback with depth testing disabled so that the
> > sky would be in the background even if the far clip-plane is moved closer.
> >
>
> Try this:
>
> int preCullDome(pfTraverser *trav, void *userData)
> {
> pfCullResult(PFIS_MAYBE | PFIS_TRUE | PFIS_ALL_IN);
> return PFTRAV_CONT;
> }
>
> int preDrawDome(pfTraverser *trav, void *userData)
> {
> float m[16];
> float c, d;
> float far;
> float near;
>
> /* get current near and far */
> pfGetChanNearFar(pfGetTravChan(trav), &near, &far);
>
> /* put here the far value you need for the dome only */
> far = 40000.0f;
>
> /* get one copy of projection matrix */
> glGetFloatv(GL_PROJECTION_MATRIX, m);
>
> /* modify current projection matrix so that we change far */
> /* value (see man glFrustum). NOTE: if any other value */
> /* apart from far is changed, you need to modify more matrix */
> /* elements */
> c = (-far + near) / (far - near);
> d = (-2 * far * near) / (far - near);
> m[10] = c;
> m[14] = d;
>
> glPushAttrib(GL_TRANSFORM_BIT);
> glMatrixMode(GL_PROJECTION);
> glPushMatrix();
> glLoadMatrixf(m);
> glPopAttrib();
>
> /* sky dome is always furthest */
> glDepthRange(1.0f, 1.0f);
> glDepthFunc(GL_EQUAL);
>
> return PFTRAV_CONT;
> }
>
> int postDrawDome(pfTraverser *trav, void *userData)
> {
> /* restore usual depth testing */
> glDepthFunc(GL_LESS);
> glDepthRange(0.0f, 1.0f);
>
> /* restore previous projection matrix */
> glPushAttrib(GL_TRANSFORM_BIT);
> glMatrixMode(GL_PROJECTION_MATRIX);
> glPopMatrix();
> glPopAttrib();
>
> return PFTRAV_CONT;
> }
>
> Please, comments to this code will be appreciated.
>
> Bye.
>
> --
> Javier Abadia Miranda / Ingeniero en Informatica
> MADRID (SPAIN) / Especialista en Informatica Grafica
> -----------------------------------------------------------------------
> List Archives, FAQ, FTP: http://www.sgi.com/software/performer/
> Submissions: info-performer++at++sgi.com
> Admin. requests: info-performer-request++at++sgi.com


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Jun 21 1999 - 07:07:32 PDT

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