[osg-users] [3rdparty] Use PNG as texture for terrain in osgEarth

Chris Hanson xenon at alphapixel.com
Tue Jan 8 03:59:16 PST 2019


If you feed the TIFF LWZ coder the same 4-bit data as the PNG is made form,
I would think it would code about as efficiently, even if the data is
stored in an 8-bit representation. Forward-dictionary compression systems
work on how many unique symbols are found and if you make a 16m color image
with only 256 colors, it'll only take 256 symbol table entries to store.

I'm not sure why the TIFF wouldn't be displaying. What is the bit depth of
the TIFF? Have you told osgEarth how to scale the elevation from the TIFF
file into real world units? If it's an 8-bit TIFF, you are only feeding it
up to 256m of elevation which won't look like much for the Andes.

On Tue, Jan 8, 2019 at 12:32 PM Rodrigo Dias <rodrigo1406 at gmail.com> wrote:

> Hi,
>
> Sorry, I didn't post the updated code:
>
>
> Code:
> #include <iostream>
> #include <osg/Camera>
> #include <osgDB/ReadFile>
> #include <osgGA/TrackballManipulator>
> #include <osgViewer/Viewer>
> #include <osgEarth/ImageLayer>
> #include <osgEarth/Map>
> #include <osgEarth/MapNode>
> #include <osgEarthDrivers/gdal/GDALOptions>
>
> using namespace std;
> using namespace osg;
> using namespace osgEarth;
> using namespace osgEarth::Drivers;
>
> int main (int argc, char** argv) {
>         MapOptions mapOpt;
>         mapOpt.coordSysType() = MapOptions::CSTYPE_PROJECTED;
>         mapOpt.profile() = ProfileOptions("plate-carre");
>         osg::ref_ptr<Map> map = new Map(mapOpt);
>         {
>                 GDALOptions gdal;
>                 gdal.url() = "br_modified.tif";
>                 osg::ref_ptr<ImageLayer> layer = new ImageLayer( "BR",
> gdal );
>                 map->addLayer( layer );
>         }
>         {
>                 GDALOptions gdal;
>                 gdal.url() = "BRalt.tif";
>                 osg::ref_ptr<ElevationLayer> layer = new ElevationLayer(
> "SRTM", gdal );
>                 map->addLayer( layer );
>         }
>         osg::ref_ptr<MapNode> mapNode = new MapNode( map );
>         osgViewer::Viewer viewer;
>         viewer.setSceneData( mapNode.get() );
>         viewer.setCameraManipulator( new osgGA::TrackballManipulator );
>         while ( !viewer.done() ) {
>                 viewer.frame();
>         }
>         return 0;
> }
>
>
>
>
> As you can see, I guess I should be seeing some elevation by now, since my
> image is a square around Brazil, and it includes a good portion of the
> Andes mountain range (with higher pixels closer to white, and sea level in
> black).
>
> The texture file is 4392x4392 pixels (1.6 MB on PNG/4-bit-depth and 2.6 MB
> on TIFF/LZW/8-bit-depth, the difference seems due to bit depth, and I'm not
> sure if I can use a 4-bit TIFF, but that's ok by now; I'll also try tiling
> later). The elevation file is 588x588 pixels (70 kB). Both TIFFs are
> GeoTIFFs.
>
> What I'm trying to accomplish is this:
> https://www.youtube.com/watch?v=vVm_qWeB9wg
>
> Thank you!
>
> Cheers,
> Rodrigo
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=75423#75423
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>


-- 
Chris 'Xenon' Hanson, omo sanza lettere. Xenon at AlphaPixel.com
http://www.alphapixel.com/
Training • Consulting • Contracting
3D • Scene Graphs (Open Scene Graph/OSG) • OpenGL 2 • OpenGL 3 • OpenGL 4 •
GLSL • OpenGL ES 1 • OpenGL ES 2 • OpenCL
Legal/IP • Forensics • Imaging • UAVs • GIS • GPS •
osgEarth • Terrain • Telemetry • Cryptography • LIDAR • Embedded • Mobile •
iPhone/iPad/iOS • Android
@alphapixel <https://twitter.com/alphapixel> facebook.com/alphapixel (775)
623-PIXL [7495]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20190108/2ed00065/attachment.html>


More information about the osg-users mailing list