osgearth
osgearth copied to clipboard
Draping - draped 3D model has incorrect bounds
I'm using osgearth v3.3 on windows 10, GL3 profile. My application is build under a Qt QOpenGLWidget and features also ImGui. Here is the capabilities :
The problem is I have an object that is a LocalGeometryNode (also tried w/ FeatureNode) and when wanting to drape the underlying geometry on the surface through an AltitudeSymbol w/ TECHNIQUE_DRAPE, I get no error but everything disapear on screen. I've tried w/ TECHNIQUE_MAP and TECHNIQUE_SCENE but the geometry does not clamp. Only w/ TECHNIQUE_DRAPE and TECHNIQUE_GPU I get the defect. Still, after everything disapear, when I zoom or pan I see osgearth log that it is loading tiles, just like it is working fine, but no display.
I get these log before everything goes away :
Before draping :
After Draping :
Have any clue on what's happening ? :)
Can you provide an earth file that reproduces the issue?
Normally I do drape from the API, but I get the same result with a model used in the earth file provided :
<map name="Default map" type="geocentric" version="2">
<options>
<!-- Setup the spatial reference system. -->
<profile/>
<!-- Setup the network proxy for remote access. -->
<proxy/>
<!-- Setup the cache method. -->
<cache>
<driver>filesystem</driver>
<path>G:/EARTH/cache</path>
</cache>
<!-- Setup cache policy. -->
<cache_policy>
<usage>read_write</usage>
</cache_policy>
<!-- Setup terrain. -->
<terrain>
<driver>rex</driver>
<gpu_tessellation>false</gpu_tessellation>
<range_mode>PIXEL_SIZE_ON_SCREEN</range_mode>
<min_tile_range_factor>10</min_tile_range_factor>
</terrain>
</options>
<Annotations>
<Model>
<position srs="wgs84" lat="43" long="0"/>
<style>
model: "G:/EARTH/data/3dmodel/platforms/rafale.osgb";
model-scale: 20;
altitude-clamping: terrain-drape;
</style>
</Model>
</Annotations>
</map>
You problem may have to do with QOpenGLWidget
which uses an FBO that OpenSceneGraph doesn't know about.
Try setting you main camera's default FBO like so (from your Qt paint function)... from memory:
void MyQOpenGLWidget::paintGL()
{
viewer->getCamera()->getGraphicsContext()->setDefaultFboId(defaultFramebufferObject());
...
Nice it does the trick thanks ! Although the model appears a bit croped somehow :
Any idea on that behavior ?
I noticed that as well. The idea of draping a 3D model is a little odd, so the use case has not really been tested much. I will mark this as a defect and we can look into it.
Closing as stale - if someone wants to post sample code to reproduce, we'll look at it anew.