OGRFeatures draped on a 3D model ?

classic Classic list List threaded Threaded
4 messages Options
JimmyXu JimmyXu
Reply | Threaded
Open this post in threaded view
|

OGRFeatures draped on a 3D model ?


Hello everyone´╝î

As we all know, OGRFeatures can be rendered as a draped layer on terrains by setting altitude-clamping to 'terrain-drape'.




And I added a .osg file model into the scene. The .osg file model is inside the polygon show in the picture below.



So how to make this polygon draped on the .osg file model too? Does anyone have an idea?
gwaldron gwaldron
Reply | Threaded
Open this post in threaded view
|

Re: OGRFeatures draped on a 3D model ?

Jimmy,
There isn't a "proper" way to do that, but a hack might be to try adding your model under the terrain group like so:

mapNode->getTerrainEngine()->addChild(model);

This might have unintended consequences though, so just keep in mind that it's a hack.

Should models included in a Map layer be affected by draping? Probably up for discussion.
Glenn Waldron / Pelican Mapping
JimmyXu JimmyXu
Reply | Threaded
Open this post in threaded view
|

Re: OGRFeatures draped on a 3D model ?

Thanks for your reply.

I tried to add my model under the terrain group using your code and It comes out like this.




The polygon is draped on the model as expected but the texture is gone. Is this the unintended consequences you said.
gwaldron gwaldron
Reply | Threaded
Open this post in threaded view
|

Re: OGRFeatures draped on a 3D model ?

Yes it is :)

The terrain rendering subsystem has a mechanism for reserving texture image units; this prevents image unit conflicts, which is (most likely) what you are seeing. That is, the draping texture is probably using the same texture image unit as the texture on your model. That is my best guess anyway.
Glenn Waldron / Pelican Mapping