bertt / i3dm-tile-cs

Reader/Writer for Instanced 3DTiles (i3dm)
MIT License
14 stars 6 forks source link

instance direction error #3

Closed XuequanZhang closed 3 years ago

XuequanZhang commented 3 years ago

Hello, I used this tool to convert i3dm and generated 3d tiles to display in Cesium, but the instanced direction is incorrect. The convert code is as follows: var glb = File.ReadAllBytes(model); var i3dm = new I3dm.Tile.I3dm(pos, glb); i3dm.FeatureTable.IsEastNorthUp = true; and the transform of the i3dm in 3d tiles is computed: var transform = GisUtil.Wgs84Transform(longitude, latitude, height).ToArray(); While the result is that all these instanced object is fall-placed. This is orginal glb file: image This is instanced object display in Cesium: image

I am confused, why the parameter "EastNorthUp" in i3dm not working, why the instanced object direction is not the same as the orginal glb file. Thank you!

bertt commented 3 years ago

Hi, so the position is ok but the rotation not in Cesium?

To get the rotations in Cesium right is quite complex is my experience. It's something with calculating i3dm.NormalUps and i3dm.NormalRights. In MapBox client things are much easier.

XuequanZhang commented 3 years ago

Hi, that's it. The positions are right but the directions are wrong. I know the rotation calculation is complex. You have discussed in this link. https://community.cesium.com/t/instance-rotation/10163

But, I don't need to rotate the glb model. I want to keep the directions of instanced objects the same as orginal glb model. In my opinion, when the parameter"EAST_NORTH_UP" is set true, and "NORMAL_UP" and "NORMAL_RIGHT" are default in b3dm file, the instanced objects should not be rotated. Do you think so? Why the instanced objects are rotated fall-placed? Thank you!

image

bertt commented 3 years ago

Ok if you don't need the rotations it should be more easy. Can you compare https://bertt.github.io/cesium_3dtiles_samples/samples/instanced/index_north.html with your case? Tool https://github.com/bertt/i3dm.tooling can assist to inspect/unpack the i3dm tiles.

XuequanZhang commented 3 years ago

Thank you very much for your patient reply.

XuequanZhang commented 3 years ago

Hello, I have solved the intance position and rotation problem, but another problem arose.

https://user-images.githubusercontent.com/44218937/115649929-d8865b00-a35a-11eb-98c8-29ff73e56a81.mp4

When I zoom or rotate the 3d earth, the instanced objects sometimes disappear. The bounding volume is set to be the extent region of all the instanced objects. Do you know why? Thank you!

bertt commented 3 years ago

What was the fix?

Disappearing features: I suspect something with geometricError in tileset.json