Re: Culling callbacks

New Message Reply Date view Thread view Subject view Author view

Nicolas Gauvin (nicolas++at++cae.ca)
Fri, 18 Apr 1997 14:35:59 -0400


On Apr 17, 1:03pm, Luciano Pinho wrote:
> Subject: Culling callbacks
> Than I should modify culling in such a way that after fustrum
> culling each 'visible' node would be tested against every oclusion
> plane's shadow volume for a more restrictive visibility testing.
>
> The problem is that the culling callback method doesn't seem to work
> properly:
>
> 1- Should I use pre or post culling?
> Pre is before fustrum culling, wich is not what I want,
> but Post is done after all the child of the node are
> processed, wich seems to be inneficient!
>-- End of excerpt from Luciano Pinho

Here is a suggestion:

Use a pre cull callback explicitely do a shallow frustum culling
test using pfChannel::contains(const pfSphere* sph) on the bounding
sphere of the current node. You need to first translate the bounding sphere
center with the current transformation matrix. If this test is_maybe then do
your own plane occlusion test.

Something like:

preCullCB( pfTraverser* _trav, void* )
{
  pfNode* node = _trav->getNode();
  pfSphere bsphere;
  _node->getBound(&bsphere);
  pfMatrix mat;
  _trav->getMat(mat);
  // translate bsphere center
  bsphere.center[PF_X] += mat[3][PF_X];
  bsphere.center[PF_Y] += mat[3][PF_Y];
  bsphere.center[PF_Z] += mat[3][PF_Z];
  pfChannel* chan = _trav->getChan();
  // test it with channel frustumn
  if (chan->contains(&bsphere) & (PFIS_MAYBE)) {
     if (yourOcclusionTest(...) == TRUE) {
       pfCullResult(PFIS_TRUE); // to bypass Performer's default culling
       return PFTRAV_PRUNE;
     }
  }
  return PFTRAV_CONT;
}

I haven't tried this myself, but I believe something like this should work.

-- 
Nicolas Gauvin			CAE Electronics Ltd., 8585 Cote De Liesse
Software Developer 		Saint-Laurent, Quebec, Canada, H4L-4X4
3-D Graphics Applications	tel: +1 514 341 2000 extension 2275
nicolas++at++cae.ca			fax: +1 514 340 5496
=======================================================================
List Archives, FAQ, FTP:  http://www.sgi.com/Technology/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 Aug 10 1998 - 17:55:05 PDT

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