How to set color of base image layer

classic Classic list List threaded Threaded
7 messages Options
Blanky Blanky
Reply | Threaded
Open this post in threaded view
|

How to set color of base image layer

Hey,

Is there an easy way to get the white marble layer and actually change the color of it dynamically when there are no other Image Layers loaded?

-Blanky
gwaldron gwaldron
Reply | Threaded
Open this post in threaded view
|

Re: How to set color of base image layer

You can use a layer shader. Check out the glsl.earth example in the repo
Glenn Waldron / Pelican Mapping
Blanky Blanky
Reply | Threaded
Open this post in threaded view
|

Re: How to set color of base image layer

This post was updated on .
Perfect thanks!

Also another layer question while we're on the base layer topics. How do I progrmatically add a base GeoTiff layer, like the world.tif used in all of the examples through the gdal programtically rather than through the earth file? I'm having an issue where it looks like the rgb is being interpreted incorrectly and everything is mostly black or a strange color. This is what I'm doing currently:

osgEarth::Drivers::GDALOptions gdal;
gdal.url() = pathToLayer;
osgEarth::ImageLayer* topoBathLayer = new osgEarth::ImageLayer(osgEarth::ImageLayerOptions("world", gdal);

I'm confused as to how the driver is supposed to know what the tile source or profile options arw and all examples I could find online looked like some variation of the above code. Thanks.

P.S. we're using 2.10

Edit: Seems like an opacity issue, if my opacity isn't 100 the layer gets these weird bands on the top and bottom. I'm assuming we're seeing the white layer below it, but it isn't visible above and below the 65 degree latitude bands on a projected mercator map. The same thing is happening on a wgs-84 geocenteic projection too.

-Blanky
gwaldron gwaldron
Reply | Threaded
Open this post in threaded view
|

Re: How to set color of base image layer

Blanky,
This sounds like a bug that was fixed recently in the master branch. Can you try it?
Glenn Waldron / Pelican Mapping
Blanky Blanky
Reply | Threaded
Open this post in threaded view
|

Re: How to set color of base image layer

I won't be able to test this at work until our lead approves the software request and he's unfortunately out for a week. Is the issue pertaining to adding a layer dynamically to the map instead of from the earth file? At this point I'm fairly certain I add the layers using the same attributes from the earth file and it looks to me like the lighting is enabled on certain bands of CADRG. I'm adding more or less 13 layers that cover almost the whole world. If I tilt the camera pitch at weird angles where the longitude bands are missing (just looks white), I can sort of see them fade in and out based on my weird angle. Also the min and max ranges don't seem to be copied correctly when I copy construct the layer using its options.
gwaldron gwaldron
Reply | Threaded
Open this post in threaded view
|

Re: How to set color of base image layer

The issue has to do with longitudinal bands near the poles appearing white with spherical mercator data.
Anyway, it's hard to speculate further without seeing it or being able to reproduce.
Glenn Waldron / Pelican Mapping
Blanky Blanky
Reply | Threaded
Open this post in threaded view
|

Re: How to set color of base image layer

This post was updated on .
Okay, it seems our issue is a bit different. It turned out the CADRG layers we were loading in weren't loaded correctly. We added the layers for all the subDataSet values correcrly and set the min and max heights to be equal for a GNC and JNC layers respectively such that at that range from the camera it will switch from one to the other. When we do the same thing programatically the CADRG just isn't looking right, because some bands are missing, and it's ignoring our min and max range settings. We've confirmed by comparing just about every attribute of the layer when added through the .earth file and our method and everything is the same down to the name of the files.

Essentially the earth file given nothing but the path, subDataSet, and either a min or max range value in meters is fine, but doing the same programatically is not displaying the information according to our settings and I've 100% checked the values are correct.


Edit: TIL be bery careful settings cacheIDs to unique values such that they can never overlap haha! That strange behavior was due to thr cache hitting the same thing for all the CADRG layers. Everything seems good now. No worries.