iTowns / itowns

A Three.js-based framework written in Javascript/WebGL for visualizing 3D geospatial data
http://www.itowns-project.org
Other
1.11k stars 303 forks source link

Unstable 3d tiles rendering in itowns #1859

Closed alexLuky closed 2 months ago

alexLuky commented 2 years ago

When I zoom or pan some tiles just not render or whole tileset destructs until the view angle or zoom will not be changed.

Your Environment

Context

Here is videos to see the behavior:

  1. https://youtu.be/ei3bzoLoTrs
  2. https://youtu.be/EzqhBOsuaBs
  3. https://youtu.be/XywzT3f29ps

I've tried:

Steps to Reproduce (for bugs)

const tiles3dLayer = new itowns.C3DTilesLayer(datasetTilesSet3dObject.id, {
    name: datasetTilesSet3dObject.name,
    source: new itowns.C3DTilesSource({
      url: datasetTilesSet3dObject.url,
    }),
    sseThreshold: 1,
}, this.itownsViewer)
itowns.View.prototype.addLayer.call(this.itownsViewer, tiles3dLayer)

Expected Behavior

I expect that all tiles in camera focus will be rendered no matter the zoom or view angle. This issue and the previous are critical for us and if there is no solution for them we'll have to avoid the itowns in our projects.

gchoqueux commented 2 years ago

Thanks to report this issue! I try with your data and there's issue with itowns

alexLuky commented 2 years ago

Thanks to report this issue! I try with your data and there's issue with itowns

Thank you very much for your involvment. We really like your product and hope the issue can be solved.

alexLuky commented 2 years ago

@gchoqueux is there any news about this issue?

jailln commented 2 years ago

Hi, Could you share your tileset or a subset of your tileset with me? I'll try to take a look at it.

alexLuky commented 2 years ago

@jailln Do you have any news about the issue?

jailln commented 2 years ago

Could you share your tileset (or a subset of it) with me so I can give it a try? I do not reproduce the issue with the tilesets I have.

alexLuky commented 2 years ago

Could you share your tileset (or a subset of it) with me so I can give it a try? I do not reproduce the issue with the tilesets I have.

Dear @jailln, I've already posted the link in the discussion section here: https://github.com/iTowns/itowns/discussions/1880#discussioncomment-3346892

Here is the link: https://storage.yandexcloud.net/gis-3d-models/data/tiles3d/Valaam_Aerial_Survey/Scene/Cesium.json

alexLuky commented 2 years ago

@gchoqueux @jailln @mgermerie Do you have any news about this issue? Now itowns looks like it does not meet minimum industry 3D-tiles standards. All datasets that we have couldn't be used with it and there is no really effective suggestion to render the 3D tiles that itowns can work with. It looks like the dead end.

jailln commented 2 years ago

Hi @alexLuky, Sorry I've missed your previous message with the link. I tested it and you just need to remove the sseThreshold parameter from your 3D Tiles layer config to make it work:

const tiles3dLayer = new itowns.C3DTilesLayer(datasetTilesSet3dObject.id, {
    name: datasetTilesSet3dObject.name,
    source: new itowns.C3DTilesSource({
      url: datasetTilesSet3dObject.url,
    }),
}, this.itownsViewer)
itowns.View.prototype.addLayer.call(this.itownsViewer, tiles3dLayer)

Cheers.

alexLuky commented 2 years ago

@jailln Well... it;s not solution at all... I don't know why you have closed the issue. When you remove the sseThreshold then the LOD of the models becomes awfall. Take a look at the screen. Is this ok? What should I do in this case? Open a new issue or codepen example to prove? It looks like just a come-off. image

jailln commented 2 years ago

Sorry if I closed it too quickly, but it solved the initial problem you described: When I zoom or pan some tiles just not render or whole tileset destructs until the view angle or zoom will not be changed.

I will look into the level of details problem and let you know. Note that I'm on leave next week so it might happen the week after.

alexLuky commented 2 years ago

dear @jailln. Thank you very much for your envolvement. But if you put this link to the Cesium then you'll get very good rendering result with all LODs in the propper place. But at the same time if I use this tileset for itowns I have huge rendering problems, such as bad details. This problem was described in this issue.

I've solved the light issue by refactor the MeshBasicMaterial to MeshStandardMaterial after this the light effects on gltf in b3dms and it looks much better but there is still the SSE kind of issues... and now we are in the dead-end because we can't use itowns with Cesium-standard 3d tiles based on sphere realization. I want to emphasize that this tileset works pretty good on Cesium.js but not in itowns. So we even tried to refactor the tileset.json from shpere to region. It becomes a little bit better more stable, but stil deconstructive.

Compromise solution for us could be generation our own b3dms tree from obj/gltf models but all libs that we found just make the one big b3dm without tilesets hierarchy,

Any way I think itowns should be patched to understand the cesium standard because all modern enterprise software generates the 3D tiles in this standard. In Cesium it works fine, in itowns - big issues.

jailln commented 2 years ago

I think I found out why the LODs (ie the child tiles) don't all get displayed:

I will test this lead when I get back in one week.

Regarding the discussion about the 3D Tiles support in itowns, it is a bit less well supported than in Cesium because the Cesium team are the one making the 3D Tiles standard, BUT we are working on improving this support (and your usecase helps us to do it) (see also #1867 and #1834, and there is more to come). Hopefully we can achieve a better support of 3D Tiles and benefit from the threejs features and performance + of all the other features of itowns that are not in Cesium (e.g. MVT support).

alexLuky commented 2 years ago

This is great news! If you will solve this and other common issues than itowns will become much more perspective framework than Cesium is.

jailln commented 2 years ago

Hello @alexLuky, I've looked into it and it turned out that my first lead was not the right one. Sadly I wasn't able to fix the problem but here is what I've found out along the way:

Do you now if there a structure change in the tiles at level 18 that could introduce this bug ?

I don't have time to continue looking into it this week but I will try to come back at it later on.

alexLuky commented 2 years ago

Greetings @jailln. When I investigated the problem, I had a version that the reason lies in the insufficient accuracy of the calculation SSE value for the camera becuase of the possible overlapping sphere boundaries, It calculates here in the code. So perhaps we have to improve the SSE calculation for margin spheres.

I suggest you to put the dataset to the Cesium and inspect the behavior there. And then search for their implementation of SSE calculation for this case.

jailln commented 2 years ago

Hi @alexLuky I also thought it came from the SSE computation at first and I actually checked the SSE computation against Cesium's one. The difference is that iTowns makes an approximation described here. Maybe we should try to replace this SSE computation to see what happens but I would rather tend to think it comes from this culling. Anyhow, the SSE computation should be more precise or the user should at least be able to choose between a precise mode and an approximated mode (faster).

I will take a look when I find some time to do it... Don't hesitate to try it also if you have time :)

alexLuky commented 2 years ago

@jailln is there any hopes?

jailln commented 2 years ago

Haven't had time to look at it yet sadly...

alexLuky commented 2 years ago

@jailln how do you do?

jailln commented 2 years ago

@gchoqueux can you take a look at it please ? :)

mgermerie commented 2 years ago

The complete 3d-tiles support is planned in the short term road map. We are currently studying possibilities in terms of libraries to enhance support (as mentioned in https://github.com/iTowns/itowns/discussions/1917).

jailln commented 1 year ago

@alexLuky this should be resolved with #2143 , can you test it and let me know please?

alexLuky commented 1 year ago

@jailln that's great, surely I will. Give some time.

jailln commented 2 months ago

Closing this it has been fixed (and still works with the new OGC3DTilesLayer based on 3DTilesRendererJS). Feel free to reopen if needed.