Ron Mayer | 18 Jul 2012 22:49

Re: Lines not showing when zoomed in orthographic projection

UPDATE:

Let me start by saying Paul was right 8) . It is the AutoTransform! The 'x' did not show when I turned off
AutoTransform because it may have been obscured by another object, so I falsely thought it was not the AutoTransform.

I spent the day debugging the bound speheres for culling and I found the problem. Here is what happens:

1) I add the new 'x' to my scene with an AutoTransform and AutoScaleToScreen=true
2) frame() is called
3) OSG prepares for culling and calls scene->getSceneData()->getBound() to calculate the bounding
sphere of the scene (ViewerBase.cpp line #760)
4) The graph gets traversed in a depth-first manner, recursevly computing the spheres
5) At some point our AutoTransform is reached, and computeBound() is called (Node line #366)
6) But allas, AutoTransform::computeBound() returns an invalid bound since the
_firstTimeToInitEyePoint flag is true! (AutoTransform.cpp line #389)
7) The  _firstTimeToInitEyePoint flag gets a false value only after the first CullVisitor has visited the
AutoTransform, which happens only AFTER the computation of the bound returns (AutoTransform.cpp lines
199 - 229).
8 ) But at that time it is too late since the value of _boundingSphereComputed is set to true (Node line #370)
so the invalid AutoTransform sphere does not get recalculated until later.

What I did is set a breakpoint in AutoTransform::computeBound(), and set _firstTimeToInitEyePoint to
false inside the debugger, and then the 'x' showed.

So to summarize the problem - the implementation of AutoTransform::computeBound()will return a valid
spehere only if the AutoTransform node was visited by the CullVisitor at least once, but since it is called
before the culling, it caches an invalid transform. 
I am not sure if this is a bug or because I may not be seeing the whole picture.

Our plan to solve this is writing our own BoundCallback and set it on the AutoTransform of our 'x'.
(Continue reading)

Robert Osfield | 24 Jul 2012 13:43
Picon

Re: Lines not showing when zoomed in orthographic projection

Hi Ron,

The AutoTransform management always hits up against the issue of it's
size being relative to each cull traversal and the cull traversal's
culling is based on subgraphs bounding volume (computed from size and
position of children) so it's a catch 22. The bounding volume initial
traversal issue is partially addressed by leaving the bounding volume
in it's invalid/undefined state, which is essential the max value <
min value, the cull traversal knows to not do a cull test on nodes
which such bounding volumes.  Unfortunately this only works for the
AutoTransform itself, the transforms parents don't know the position
of a node with a invalid bounding volume and needs to compute it's own
size so ignores the invalid ones but in the process can lead to an
inappropriate size.

I have to head off line for a short while so can't provide a
suggestion for a fix right away.

Robert.

On 18 July 2012 21:49, Ron Mayer <rabraham@...> wrote:
> UPDATE:
>
> Let me start by saying Paul was right 8) . It is the AutoTransform! The 'x' did not show when I turned off
AutoTransform because it may have been obscured by another object, so I falsely thought it was not the AutoTransform.
>
> I spent the day debugging the bound speheres for culling and I found the problem. Here is what happens:
>
> 1) I add the new 'x' to my scene with an AutoTransform and AutoScaleToScreen=true
> 2) frame() is called
(Continue reading)


Gmane