gwaldron / osgearth

3D Maps for OpenSceneGraph / C++14
https://www.pelicanmapping.com/home-1/opensource
Other
1.52k stars 782 forks source link

clamping Terrapage, and osgb databases #693

Closed Stupefy closed 8 years ago

Stupefy commented 8 years ago

Hello, I am using the simple driver to create a model based on Terrapage (archive.txp), and .osgb databases. The database seems to be loading just fine as long as I disable the shader policy. The problem I am having is that the database does not seem to clamp to the surface of the earth so the further from the location point, that is specified as the center of the database, the more inaccurate the elevation representation becomes. I have tried adding a style with terrain drape but I do not think the style effects the simple model. I am currently using the SIMDIS SDK 1.3 version of osgEarth (3.0.0 dev) and loading these databases using an earth file entry. Is there a different way I should be loading this database data?

gwaldron commented 8 years ago

osgEarth is a "direct from source" system. The ideal approach would be to take the source data used to create the TXP or OSGB terrain and read that directly into osgEarth.

The simple model driver does not have a draping option. We could add it but the results may not be what you expect. With draping, osgEarth essentially takes a top-down picture of the external model and projects that image orthographically onto the surface of the osgEarth terrain. As you can imagine, this flattens any 3D geometry that was in the original model.

Stupefy commented 8 years ago

Is there any way that rather than clamping everything to the terrain that it just pulls it down based on offset? The height map would then still maintain integrity, and then open up a world of databases that already exist

On Fri, Feb 5, 2016 at 8:52 AM, Glenn notifications@github.com wrote:

osgEarth is a "direct from source" system. The ideal approach would be to take the source data used to create the TXP or OSGB terrain and read that directly into osgEarth.

The simple model driver does not have a draping option. We could add it but the results may not be what you expect. With draping, osgEarth essentially takes a top-down picture of the external model and projects that image orthographically onto the surface of the osgEarth terrain. As you can imagine, this flattens any 3D geometry that was in the original model.

— Reply to this email directly or view it on GitHub https://github.com/gwaldron/osgearth/issues/693#issuecomment-180367884.

Stupefy commented 8 years ago

I would love to get the source that was used to create these databases and just use that instead, but not only is the database loading faster, I do not always have access to the source data as some of these databases are pay for products created by other sub contractors.

On Fri, Feb 5, 2016 at 9:02 AM, Dave dave.m.browning@gmail.com wrote:

Is there any way that rather than clamping everything to the terrain that it just pulls it down based on offset? The height map would then still maintain integrity, and then open up a world of databases that already exist

On Fri, Feb 5, 2016 at 8:52 AM, Glenn notifications@github.com wrote:

osgEarth is a "direct from source" system. The ideal approach would be to take the source data used to create the TXP or OSGB terrain and read that directly into osgEarth.

The simple model driver does not have a draping option. We could add it but the results may not be what you expect. With draping, osgEarth essentially takes a top-down picture of the external model and projects that image orthographically onto the surface of the osgEarth terrain. As you can imagine, this flattens any 3D geometry that was in the original model.

— Reply to this email directly or view it on GitHub https://github.com/gwaldron/osgearth/issues/693#issuecomment-180367884.

Stupefy commented 8 years ago

Any hints on how best to modify SimpleModelSource.cpp to help me wrap the model around the surface of the earth? not really terrain clamping it but rather just pulling down each point towards the center of the earth based on the altitude of the flat projection offset from the surface. Right now I have a flat database that gets further from the surface the further from the origin. I was hoping to apply some clamping technique but find that my knowledge of osg and osgEarth could use some improvement. I am able to rebuild the plugins just not sure what to add to it yet to get the desired effect.

-Dave

On Fri, Feb 5, 2016 at 9:03 AM, Dave dave.m.browning@gmail.com wrote:

I would love to get the source that was used to create these databases and just use that instead, but not only is the database loading faster, I do not always have access to the source data as some of these databases are pay for products created by other sub contractors.

On Fri, Feb 5, 2016 at 9:02 AM, Dave dave.m.browning@gmail.com wrote:

Is there any way that rather than clamping everything to the terrain that it just pulls it down based on offset? The height map would then still maintain integrity, and then open up a world of databases that already exist

On Fri, Feb 5, 2016 at 8:52 AM, Glenn notifications@github.com wrote:

osgEarth is a "direct from source" system. The ideal approach would be to take the source data used to create the TXP or OSGB terrain and read that directly into osgEarth.

The simple model driver does not have a draping option. We could add it but the results may not be what you expect. With draping, osgEarth essentially takes a top-down picture of the external model and projects that image orthographically onto the surface of the osgEarth terrain. As you can imagine, this flattens any 3D geometry that was in the original model.

— Reply to this email directly or view it on GitHub https://github.com/gwaldron/osgearth/issues/693#issuecomment-180367884 .

gwaldron commented 8 years ago

You are better off writing a new Model Source to do something like that. What you are proposing to do would involve two steps.

The first is reprojecting your model into the SRS of the osgEarth map. osgEarth doesn't have any built-in tools for reprojecting scene geometry directly, but in theory it would not be too hard to go through the model point by point. This is the only way to maintain geospatial correlation.

After that, you would need to resolve the rendering conflicts between your terrain and the osgEarth terrain, since they will occupy the same space but have different elevations, resolutions, etc. and that will make for lots of rendering artifacts. Masking (cutting a hole in osgEarth and placing your model in the hold -- see the mask.earth example) would be my usual suggestion, but it does not work with ust any model. Paging or multi-LOD formats (like TXP) are out, as is any model without a clearly defined boundary.

Compositing triangulated terrain models is not a design goal of osgEarth. So while there are paths to get there (sometimes) it requires extra work and trade-offs.

gwaldron commented 8 years ago

Dave, let me know if there's anything else I can answer for you with on this topic.

Stupefy commented 8 years ago

Hey Glenn, thanks for following up. I kind of went stale on this issue as I do not quite understand enough about osgEarth to wright my own model source. I was able to modify the the simple model source plugin to take use a custom shader that would pull the terrain down to the surface but it was not correlating correctly so I put the issue on hold for a bit.

On Thu, Apr 14, 2016 at 8:40 AM, Glenn notifications@github.com wrote:

Dave, let me know if there's anything else I can answer for you with on this topic.

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/gwaldron/osgearth/issues/693#issuecomment-209917874

gwaldron commented 8 years ago

OK. I'll leave the ticket open in case you want to revisit in the future.

gwaldron commented 8 years ago

Closing due to inactivity; may reopen later if necessary