osgearth
osgearth copied to clipboard
cull callback for featureNode doesn't work.
Adding a cull callback via the call addCullCallback()
to a FeatureNode doesn't appear to work with view frustum culling. When I pan away from the FeatureNode on the map so that the FeatureNode is outside of the field of view, the cull callback continues to execute which it shouldn't.
I added the call setCullingActive(true)
to the FeatureNode which has no effect.
I also noticed that a similar issue #989 addressed something similar in where it was stated that it was fixed. My FeatureNode is also using GPU clamping.
Is there something more that needs to be done so that the cull callback works?
I'm using osgEarth 3.1 on Windows 10 x64.
-Shayne
So...it appears that if I comment out the line
feature->style()->getOrCreate<AltitudeSymbol>()->TECHNIQUE_GPU;
The cull callback starts to work as expected.
Strange. Is that line in your code?
Well...it was, until I commented it out to get my cull callback to work.
I only asked because the line itself doesn't appear to do anything; it's just referencing an enum.
Once I get my computer back online, I will double check. I may have copied it wrong since the code is on another computer that has no access to the internet.
On 06/06/2022 8:11 AM Glenn ***@***.***> wrote: I only asked because the line itself doesn't appear to do anything; it's just referencing an enum. — Reply to this email directly, view it on GitHub https://github.com/gwaldron/osgearth/issues/2074#issuecomment-1147491110 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ATC464MJSBJCZMBBJVYA45LVNYBHNANCNFSM5W3X2XTQ . You are receiving this because you authored the thread.Message ID: ***@***.***>
Here's the actual code...
AltitudeSymbol* alt = _feature->style()->getOrCreate<AltltudeSymbol>();
alt->clamping() = alt->CLAMP_TO_TERRAIN;
alt->technique() = alt->TECHNIQUE_GPU;
If I comment out the 3rd line alt->technique() = alt->TECHNIQUE_GPU;
, the cull callback set on the featureNode begins to work as expected. If I leave the line uncommented, the cull callback always gets executed even though the featureNode is completely culled away by the view frustum.
OK, I see what you are saying now.
The thing about GPU clamping is that a shader will move the geometry to a new location at render time. OSG has no way of knowing where the final location will be, so we have to disable the standard OSG bounding-sphere-based culling. This happens in ClampableNode
. This means that OSG will always invoke your cull callback since it has to assume the node is potentially visible.
That makes sense. I'll just leave GPU clamping disabled for now...
Thanks for the detailed feedback.