On 2/26/07, DANIEL BASS <BASSD at aaicorp.com> wrote: > I have a simulation that uses an arbitrarily rich terrain database that is viewed from a static eyepoint. > The user interacts with models that move around wrt the terrain. Since the eyepoint is fixed for the > duration of a scenario, I would like to optimize the rendering of the terrain by taking advantage of that > fact. > > In particular: > A) Culling the terrain once and retaining the cull results for all subsequent frames > B) After the first render, run all the geometry again with an occlusion test and throw away all > geometry that is, in fact, occluded. > > However, I am not at all clear on how I would do either of these things.
Me too :-) > Can someone offer me a clue? So here's what I tried - it seems to work: within OSG 1) Added to Node & Drawable a trinary variable w/ cull results (INCLUDE, EXCLUDE, UNKNOWN) and methods to set & get 2) Added to CullVisitor two booleans - saveCullResults and useSavedCullResults 3) in the various CullVisitor::apply() methods, first, if using saved results, test the (node) and if EXCLUDEd, return w/o descending second, if saving results, anywhere the isCulled() would reject the node, set the (node) cull result to EXCLUDE before returning. otherwise, set cull result to INCLUDEd and descend. Similarly for Drawables w/in a Geode. In my application: After loading terrain and setting view parameters: 1) Initialize CullVisitor to save and not reuse cull results 2) Cull 3) With a node visitor, identify all drawables not culled 4) Draw 5) Set Depth attribute at top level to EQUAL | OVERRIDE 6) With a node visitor, add callback to non-culled drawables to begin & end pixel count query 7) Cull again 8) Draw w/o clearing Depth buffer 9) Get query results and if a drawable has 0 pixels drawn, set the drawables cull results to EXCLUDE 10) If all of a Geode's drawables are now EXCLUDEd, then EXCLUDE the Geode, and similarly walk up the tree. With all that said, here are some new questions: 1) What am I missing that might make this fail? 2) I did this with the baseline 1.2 delivery - what things in the current development that will interract with this? 3) Eventually I would be delivering the app - executable only - based on some modified OSG library, to a customer. What are the OSG license obligations? Thanks, --daniel _______________________________________________ osg-users mailing list [email protected] http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/
