The rendering results of 3dtiles in cesiumjs and cesium for Unreal are inconsistent

As shown in the figure, the rendering results of the same 3dtiles are inconsistent between the latest version of cesiumjs and the latest version of cesium for Unreal (the rendering results in cesiumjs are negotiated). My UE version is 5.3.2. 3dtiles has been uploaded.



3dtiles.zip (27.2 MB)

OK, this looks like a tricky one…


First, an unrelated aside: I noticed that this tileset very prominently shows an issue in CesiumJS, namely, certain tiles/models disappearing, depending on the view direction. I added a comment in this issue where this is tracked.


About the rendering in Cesium For Unreal:

I haven’t tested this locally, but it strongly looks like there is something wrong with the transforms in general. Specifically, it looks like some of these … round things … (I’ll just call them “basins” now, for lack of a better word) are not shown at all. And when zooming closely into the screenshot, one can see that one of these basins seems to be at least at a slightly wrong position:


About the rendering in CesiumJS:

When zooming to these basins then it does not necessarily look “wrong”:

One could think that these basins simply do have different colors/materials.

But now comes the interesting part:

These are just different instances of the same model! They are instantiated via an I3DM.

  • The right group of 2x2 basins are four instances of the same GLB, where two of these rectangular thingies appear exactly opposite of each other
  • The left group of 2x2 basins are four instances the same GLB, where none of these rectangular thingies appear exactly opposite of each other

This means that one could explain differences between the left 2x2 group and the right 2x2 group. But within these groups, these are the exact same model!

Looking at the respective GLB files:

Cesium Forum 36949 different appearance

One can see that they are not really soooo different, visually. This confirms that the different appearances in CesiumJS are not caused by different materials. They are only caused by the different instance transforms that these models have in the I3DM data.

I have not yet looked at the I3DM data. But there are some “obvious” candidates for the source of this problem. Likely, something related to a ~“scaling factor of -1.0”, somewhere…

Confirmed:

Do you mean that the value of SCALE_NON_UNIFORM cannot be negative? But even if I take the absolute value, the rendering result of 3dtiles is still incorrect

I think that the value of SCALE_NON_UNIFORM is allowed to be negative. But in CesiumJS, it displays the same model mutliple times, with different appearances. And it is very likely that this is caused by the negative scaling (which would mean that it is a bug in CesiumJS - this, in turn, still has to be confirmed).

But even if I take the absolute value, the rendering result of 3dtiles is still incorrect

It could be important to say exactly whether it is incorrect in ‘Cesium For Unreal’ or in CesiumJS (and maybe add details, like a screenshot, what “incorrect” means here).

Hello, what I mean is that when I set the SCALE∝N_UNIFORM to a positive number, the rendering results of 3dtiles in cesiumjs and cesium for Unreal are incorrect. Below are screenshots and 3dtiles files.



That’s not too surprising. The actual, final position of the vertices is affected by all the properties, the NORMAL_RIGHT and NORMAL_UP, and the POSITION, and the SCALE_NON_UNIFORM. Simply changing the values of the SCALE_NON_UNIFORM will not yield correct results.

But again: The fact that the colors/appearances are wrong in this case is likely caused by a bug in CesiumJS. I can try to allocate some time to create a test model, but maybe someone from the Cesium For Unreal or CesiumJS core teams will chime in here.

Thank you for your patient answer.

I did create another test data set. But I think that, under the hood, the different visual appearances of the instances in CesiumJS is just another case of an existing issue: The I3DM transforms affect the normals in a way they shouldn’t.

I added a test data set, comment, and link to this thread at Wrong normals for instanced models with node scaling in glTF · Issue #11477 · CesiumGS/cesium · GitHub


All this still does not explain why the positions of some for these instances seem to be wrong in Cesium For Unreal. This probably has to be investigated further.
(Not sure who is the best to ping here - I think some of the previous things related to I3DM had been handled by @Timothy_Moore …?)

Hi,
Thanks to @newpeople123 for the test dataset. It exposed a bug in the Cesium Native library, described in I3dm instance transforms can be wrongly transcoded for 180 degree rotations · Issue #1046 · CesiumGS/cesium-native · GitHub and addressed in Calculate I3dm instance rotations by converting basis to a matrix by timoore · Pull Request #1047 · CesiumGS/cesium-native · GitHub. That said, I believe the negative instance scaling is causing problems in Unreal and is the reason why some instances don’t display at all there, so even if it’s in spec, I think they are best avoided.