Coder Social home page Coder Social logo

quantized-mesh-tile's Introduction

quantized-mesh-tile's People

Contributors

bertt avatar loicgasser avatar rolker avatar tomvantilburg avatar tschlemmer avatar umeier avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

quantized-mesh-tile's Issues

Behavior of method utils.collapseIntoTriangles

Hi Loic,

merry Christmas and a happy new year ... and so on :)

I was preparing a PR for a solution of the vertex normals on the tile edges and stumbled over the (for me irritating) behavior of the method utils.collapseIntoTriangles.

Long story short, i try to give the TerrainTopology a 'effectiveBoundary' and a list of overlapping triangles ( i guess you mentioned something like this in a earlier discussion).
The TerrainTopology splits the triangles on the boundary and creates so a outer and a inner (effective) List of Faces.

For this design i used the collapseIntoTriangles-Method, but came up with irritating artefacts.
Then i tried to replace 'collapseIntoTriangles'-Method with the shapely.ops.triangulate-Method.
The result with 'shapely.ops.triangulate'-method (delauney-triangulation from geos-lib) gives a expected result of outer and inner faces.
And...of course.. the unittests in TestCollapseIntoTriangle all failed, if i substitute the result of 'shapely.ops.triangulate' into 'collapseIntoTriangles'.

So , for now i dont get into the algorithmus of collapseIntoTriangles. Can you give me any hints to understand the concept?

Oh, i forgot...what i want to achieve...calculateNormals with all faces and use only the effective faces for the terrain tile.

Workflow from DEM to QM

Thank you for making this open source and your informative talk. We are looking to implement a workflow for world topo coverage using QM. What does your workflow look like going from DEM to a fully tiled set? Right now we are unsure how to best create the triangles from DEMS. Thank you again for you work.

Correct Lighting

Hi @loicgasser ,

i used successfully your library to create terrain-files from my mesh-data.
Thanks a lot for this great tool!

Unfortunately is the shading in cesium not correct. In #6 you mentioned, that lighting is not correct yet.

After some stumbling around in the code i've got following question:
Why you use wheightedNormals in computeNormals (utils.py line 185)?

According to the code in Cesium's GeometryPipeline it is not neccessary to get the vertex-normals.

for i in xrange(0, numFaces):
face = faces[i]
for j in face:
normalsPerVertex[j] = c3d.add(normalsPerVertex[j], normalsPerFace[i])

instead of:

for i in xrange(0, numFaces):
face = faces[i]
weightedNormal = [c * areasPerFace[i] for c in normalsPerFace[i]]
# alternative?
#weightedNormal = c3d.multiplyByScalar(normalsPerFace[i],areasPerFace[i])
for j in face:
normalsPerVertex[j] = c3d.add(normalsPerVertex[j], weightedNormal)

Merge two mesh tiles?

Hi,

I have a terrain mesh tile, and another one containing only terrain inside a polygon, and I want to modify the first tile by embedding the terrain from the second tile's polygon into it.

Is there a way to accomplish this using this library?

Tile parsing error uVertexCount

I'm trying to parse a terrain tile with the following code but got an error about uVertexCount.
Tile 1608.zip
I've checked the Gzip compression. Tile is rendered well in the Cesium viewer.

Code:

from quantized_mesh_tile.global_geodetic import GlobalGeodetic
from quantized_mesh_tile.terrain import TerrainTile
geodetic = GlobalGeodetic(True)
[z, x, y] = [11,2107,1608]
[minx, miny, maxx, maxy] = geodetic.TileBounds(x, y, z)
ter = TerrainTile(west=minx, south=miny, east=maxx, north=maxy)
ter.fromFile('1608.terrain')

Stacktrace:

Traceback (most recent call last):
  File "test.py", line 24, in <module>
    ter.fromFile('1608.terrain')
  File "C:\Python27\lib\site-packages\quantized_mesh_tile\terrain.py", line 433, in fromFile
    self.fromStringIO(f, hasLighting=hasLighting, hasWatermask=hasWatermask)
  File "C:\Python27\lib\site-packages\quantized_mesh_tile\terrain.py", line 334, in fromStringIO
    unpackEntry(f, TerrainTile.vertexData['uVertexCount'])
  File "C:\Python27\lib\site-packages\quantized_mesh_tile\utils.py", line 19, in unpackEntry
    return unpack('<%s' % entry, f.read(calcsize(entry)))[0]
struct.error: unpack requires a string argument of length 2

Any idea whats going on?

unpack requires a string argument of length 2?

when I run the following code, an error about the unpack method
is returned. Any ideas how to fix this?

from quantized_mesh_tile.global_geodetic import GlobalGeodetic
from quantized_mesh_tile.terrain import TerrainTile
geodetic = GlobalGeodetic(True)
[z, x, y] = [9, 533, 383]
[minx, miny, maxx, maxy] = geodetic.TileBounds(x, y, z)
ter = TerrainTile(west=minx, south=miny, east=maxx, north=maxy)
ter.fromFile('9_533_383.terrain')

Error:

Traceback (most recent call last):
  File "test.py", line 24, in <module>
    ter.fromFile('9_533_383.terrain')
  File "C:\Python27\lib\site-packages\quantized_mesh_tile\terrain.py", line 433, in fromFile
    self.fromStringIO(f, hasLighting=hasLighting, hasWatermask=hasWatermask)
  File "C:\Python27\lib\site-packages\quantized_mesh_tile\terrain.py", line 334, in fromStringIO
    unpackEntry(f, TerrainTile.vertexData['uVertexCount'])
  File "C:\Python27\lib\site-packages\quantized_mesh_tile\utils.py", line 19, in unpackEntry
    return unpack('<%s' % entry, f.read(calcsize(entry)))[0]
struct.error: unpack requires a string argument of length 2

Crash on check if vLight exists

in terrain.py line 653:
if self.vLight: should become if len(self.vLight) > 0: since self.vLight is a list.

Currently it results in a numpy error mentioning The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

Compatibility problems between "cesium-terrain-builder" and "quantized-mesh-tile"

I generated terrain-tiles with the docker- version of cesium-terrain-builder . The tiles are working with Cesium, all looks good to me.
Now I would like to decode and edit single tiles with "quantized-mesh-tile". I follow the tutorial but face an error: "unpack requires a buffer of 2 bytes"
image

It seems to me, the terrain-tiles built with ctb are not compatible to this library. Are there any ideas how to fix this?

Issue also reported here: geo-data/cesium-terrain-builder#89

may i know if this quantized-mesh tiles has “metadata” extension?

Hi there
I'm not a python programmer,this is my first meet python tools.I used CTB before to generate quantized-mesh.But there may have some bugs.Because the CesiumJS not only need layer.json but also need metadata extension in 0/0/0.terrain and 0/1/0.terrain and every tile in level10 to init the availbility.We can trace the code at Cesium Source Code.

This rule can be find by Cesium World Terrain which provide by Cesium ion.

So I'm looking for a new tools to generate the quantized-mesh tiles
,and my problem is does the tiles created by this python tools has metadata extension in 0/0/0.terrain and 0/1/0.terrain and every tile in level10 ?

Best,zhangiser

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.