Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quantized-mesh output support #63

Closed
wants to merge 6 commits into from

Conversation

ahuarte47
Copy link

Provides some new features:

  • New quantized-mesh format ouput (-f Mesh), optionally you could add VertexNormals with -N option.
  • New metadata file output.
  • New cesium-friendly option to automatically create missing root tiles (level 0).
  • Consider nodata values when creating tiles.
  • Catch GDAL 'Integer overflow' error when creating tiles of low levels.
  • Refactoring of code to easily write new output formats.

Details:
https://www.linkedin.com/pulse/fast-cesium-terrain-rendering-new-quantized-mesh-output-alvaro-huarte/

Provides two new features:
- New quantized-mesh format ouput
- New metadata file output
It simplifies the code to write new output formats as MBTiles... Defines
an set abstract clases anyone can override to implement its own logic
when serializing.
@ahuarte47 ahuarte47 changed the title Master quantized mesh Quantized-mesh output support May 10, 2018
@ahuarte47 ahuarte47 closed this May 10, 2018
@ahuarte47 ahuarte47 reopened this May 10, 2018
@bjpirt
Copy link

bjpirt commented May 10, 2018

@ahuarte47 following on from the comment in #55 this builds fine now - I still have to comment out the lines in GDALTiler.cpp containing GDALCreateOverviewDataset as this seems to be missing from my GDAL lib - from previous comments I'm hoping this won't affect mesh generation.

Thanks so much for the speedy response - hopefully it can get merged upstream soon.

@markerikson
Copy link

@bjpirt : the workaround is to manually drop a copy of gdaloverviewdataset.cpp into the project, and #include "gdaloverviewdataset.cpp" right above the place that function is used.

@bjpirt
Copy link

bjpirt commented May 10, 2018

@markerikson thanks, I'll give that a shot

@ahuarte47
Copy link
Author

ahuarte47 commented May 10, 2018

Thanks @bjpirt, I would like reopening the original PR, I did a disaster with git :-(

@mrgloom
Copy link

mrgloom commented May 22, 2018

Catch GDAL 'Integer overflow' error when creating tiles of low levels.

Integer overflow problem is solved? Workaround is not needed?
#28

@ahuarte47
Copy link
Author

Yes, I think so, but I have only tested it with my own data

@mrgloom
Copy link

mrgloom commented Aug 2, 2018

ctb still have problem with integer overflow.
#28

@ahuarte47
Copy link
Author

ahuarte47 commented Aug 2, 2018

Master version doesn't include any fix about this, this pull (#64) contains a fix, but it has not been merged yet.

@mrgloom
Copy link

mrgloom commented Aug 2, 2018

git clone https://github.com/geo-data/cesium-terrain-builder.git
cd cesium-terrain-builder
git reset --hard 8dd633c13582956a2bfdd9f447f62bde04682b9a
#git fetch origin pull/63/head:pull-63-branch
#git checkout pull-63-branch
git fetch origin pull/64/head:pull-64-branch
git checkout pull-64-branch
wget -O diff.patch https://github.com/geo-data/cesium-terrain-builder/files/2025776/diff.txt
git apply diff.patch
mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Release ..
make all

Build of #63 fails with:

Scanning dependencies of target ctb
[  5%] Building CXX object src/CMakeFiles/ctb.dir/GDALTile.cpp.o
[ 11%] Building CXX object src/CMakeFiles/ctb.dir/GDALTiler.cpp.o
[ 17%] Building CXX object src/CMakeFiles/ctb.dir/GDALDatasetReader.cpp.o
[ 23%] Building CXX object src/CMakeFiles/ctb.dir/CTBFileTileSerializer.cpp.o
/home/my_user/temp/cesium-terrain-builder/src/CTBFileTileSerializer.cpp: In member function ‘virtual bool ctb::CTBFileTileSerializer::serializeTile(const ctb::GDALTile*, GDALDriver*, const char*, const CPLStringList&)’:
/home/my_user/temp/cesium-terrain-builder/src/CTBFileTileSerializer.cpp:117:98: error: passing ‘const CPLStringList’ as ‘this’ argument of ‘char** CPLStringList::List()’ discards qualifiers [-fpermissive]
   poDstDS = driver->CreateCopy(temp_filename.c_str(), tile->dataset, FALSE, creationOptions.List(), NULL, NULL);
                                                                                                  ^
make[2]: *** [src/CMakeFiles/ctb.dir/CTBFileTileSerializer.cpp.o] Error 1
make[1]: *** [src/CMakeFiles/ctb.dir/all] Error 2
make: *** [all] Error 2

Build of #64 look ok, but with warnings:

/home/my_user/temp/cesium-terrain-builder/tools/ctb-tile.cpp: In member function ‘void TerrainMetadata::writeJsonFile(const string&, const string&, const string&, const string&, bool) const’:
/home/my_user/temp/cesium-terrain-builder/tools/ctb-tile.cpp:493:23: warning: format ‘%li’ expects argument of type ‘long int’, but argument 3 has type ‘int’ [-Wformat=]
           level.finalY);
                       ^
/home/my_user/temp/cesium-terrain-builder/tools/ctb-tile.cpp:493:23: warning: format ‘%li’ expects argument of type ‘long int’, but argument 4 has type ‘int’ [-Wformat=]
/home/my_user/temp/cesium-terrain-builder/tools/ctb-tile.cpp:493:23: warning: format ‘%li’ expects argument of type ‘long int’, but argument 5 has type ‘int’ [-Wformat=]
/home/my_user/temp/cesium-terrain-builder/tools/ctb-tile.cpp:493:23: warning: format ‘%li’ expects argument of type ‘long int’, but argument 6 has type ‘int’ [-Wformat=]
Linking CXX executable ctb-tile
[100%] Built target ctb-tile

What is the difference between #63 and #64 ?

@ahuarte47
Copy link
Author

Sorry, #64 is the correct one. It is the open pull that contains the last code.

@sunhongyue4500
Copy link

Thanks for the awesome PR. @ahuarte47
I use new q-mesh tiles in my proj. All current detail tiles appear when i zoom in. While some tiles don't load when i zoom out. Like this:
bug2
How can i fix this? thanks.

@sunhongyue4500
Copy link

Oops. It seems to be the problem of my data source. I re-tile it and now it works. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants