From: Gordon Tomlinson (gordon++at++gordon-tomlinson.com)
Date: 01/18/2006 05:12:51
Intersection test are expensive especially if you do not have a well
balanced tree (quad or similar) and or large pools geometry and you can only
do a limited number per frame depending on you scenes complexity,
composition and desired frame rate etc
In the first instance your intersections code should be testing bounding
scene of nodes so that it can quickly reject parts of the scene graph that
are not with in you line segments, that why a well balanced and spatially
partition tree is so important for intersection test. If you data is big
soups of tri's then you need to look at breaking them up into discreet
spatially partitioned nodes etc
The GPU will know nothing about your scene graph so you will get back very
limited hit information how would you know which node had been hit etc,
intersections testing is inherently tied to your scene graph and the
majority of case.
One way to typically way to gain extra performance with isectors is to
run-them asynchronously and locked on to a separate CPU
Another approach is to run the intersections on a dedicate host machine that
simple has a copy of the scene graph for intersection and does not have nay
visuals or draw etc
90x ? What?
600000 tests with what? is this triangles/primitives or 600000 isectors
Best Regards
Gordon
______________________________________________
Gordon Tomlinson
Email : gordon++at++gordon-tomlinson.com
Website : www.3dscenegraph.com
______________________________________________
"Self defence is not a function of learning tricks
but is a function of how quickly and intensely one
can arouse one's instinct for survival"
- Master Tambo Tetsura
-----Original Message-----
From: owner-info-performer++at++performer.engr.sgi.com
[mailto:owner-info-performer++at++performer.engr.sgi.com] On Behalf Of Christian
Rothländer
Sent: 18 January 2006 11:48
To: info-performer++at++sgi.com
Subject: [info-performer] Intersection testing
Hi there
I am currently writing code for a project, which needs many Intersection
tests. While benchmarking the Algorithm it became obvious that the
Intersection tests run on the processor and not in graphic hardware. Is
there a possibility to move the code to the graphic system to get a faster
testing? .. Currently I have about 90x complexity in comparison to the
testing time, which is simply impossible, because in a normal task the
system would work for about 2 days :-( .
I would need about 600.000 Tests per second.
The intersection_testing function is attached, perhaps somebody out there
has a solution for the Problem, otherwise I need to reduce the testing rate
and testing resolution to get a better runtime (1 night would be ok).
Christian
intersection_data nameit::isecTest(pfSeg line){
intersection_data daten;
pfSegSet segset;
pfHit **hits[32];
int isect;
segset.activeMask = 1;
segset.isectMask = 0x01;
segset.discFunc = NULL;
segset.mode = PFTRAV_IS_PRIM;
segset.segs[0].pos.set(line.pos[0], line.pos[1], line.pos[2]);
segset.segs[0].dir.set(line.dir[0], line.dir[1], line.dir[2]);
segset.segs[0].length = line.length;
isect = Shared->scene->isect(&segset, hits);
#ifdef DEBUG
std::cout << "Name wird ermittelt fr Objekt Nummer :" <<
index << std::endl;
#endif
//Hier wird die Namensbersetzung ausgefhrt:
//Immer im Elternknoten wird nach dem Namen nachgeschlagen
pfGeode *node;
(*hits[0]) -> query(PFQHIT_NODE, &node);
if (node->getNumParents() == 0 || node->getName() != NULL) //Wir
haben keine Elternknoten -> meistens Himmel
{
//std::cout << "a" << std::endl;
if (node->getName() != NULL){
//std::cout << node->getName() << std::endl;
daten.name = (node->getName());
}
else{ daten.name = "Unbenannt";
}
}
else { //Wir suchen in 3 Ebenen nach einem Namen, wenn
dieser nicht gefunden wird -> PECH
if (node->getParent(0)->getName() != NULL){
//std::cout << "b" << std::endl;
//std::cout << node->getParent(0)->getName() <<
std::endl;
daten.name =(node->getParent(0)->getName());
}
else if (node->getParent(0)->getNumParents() != 0 &&
node->getParent(0)->getParent(0)->getName() != NULL){
//std::cout << "c" << std::endl;
//std::cout <<
node->getParent(0)->getParent(0)->getName() << std::endl;
daten.name
=(node->getParent(0)->getParent(0)->getName());
}
else if (node->getParent(0)->getParent(0)->getNumParents()
!= 0 &&
node->getParent(0)->getParent(0)->getParent(0)->getName() != NULL){
//std::cout << "d" << std::endl;
//std::cout <<
node->getParent(0)->getParent(0)->getParent(0)->getName() << std::endl;
daten.name
=(node->getParent(0)->getParent(0)->getParent(0)->getName());
}
else { daten.name =("Unbenannt");
//std::cout << "Kein Name gefunden" << std::endl;
}
}
#ifdef DEBUG
std::cout << " fertig" << std::endl;
#endif
//pnt == Punkt der Intersection.. wie komm ich dran mit was die sich
schneidet
pfVec3 pnt;
pfMatrix matt;
(*hits[0])->query(PFQHIT_POINT, pnt.vec);
(*hits[0])->query(PFQHIT_XFORM, matt.mat);
pnt.xformPt(pnt, matt);
///Punkte der getroffenen Objekte speichern
daten.x = pnt[0];
daten.y = pnt[1];
daten.z = pnt[2];
daten.fix = 0;
return daten;
}
-----------------------------------------------------------------------
List Archives, Info, FAQ: http://www.sgi.com/software/performer/
Open Development Project: http://oss.sgi.com/projects/performer/
Submissions: info-performer++at++sgi.com
Admin. requests: info-performer-request++at++sgi.com
-----------------------------------------------------------------------
This archive was generated by hypermail 2b29 : Wed Jan 18 2006 - 05:13:37 PST