When there is only 1 instance the effect does not occur
Cesium version: 1.119
So Iāve got the feeling there goes something wrong in CesiumJS visualizing some glTF models. Maybe there is a clue in comparing the two glTFās but itās a time consuming processā¦
It appears that the one instanced version is getting culled based on the location of the other instance.
This reminds me of a previously reported issue. Would you be able to confirm that the transformation matrix of the glTF node in the I3DM is not the identity matrix?
The task to investigate this is moved slightly up my TODO list each time when it is reported, but itās still struggling to move to the top (Iāll have to familiarize myself with some aspects of the culling first).
But as a first pass here: The original model has this node structure:
FYI to āfixā the problematic windmill model Iāve used Online glTF model repair tool for free, exported obj and converted to glbā¦ clumsy method, the animation is removed and the model is gray but at least the issue is no longer there.
Iām curious (and this might also be a reason to move this up in my TODO list), but from the description here (and previous threads), it sounds like itās really related to the root transform, because thatās the only difference between those files that Iād consider even possibly relevant. One first step could be to drag-and-drop the original model into https://gltf.report/, apply clearNodeTransform in the script, and see whether that fixes it. (Iāll try to allocate at least a short time slice for that - if it fixes it, then mapping that to the point where something goes wrong in the culling is another task, but it could bring an insight, at least)
Animation windmill is messed up (Btw something similar with this animation happens when upgrading this tileset to 1.1 using 3d-tiles-tools might have to check on that)
Conclusion: So it should be something with the node transforms indeed
I think that the way of using clearNodeTransform is not perfectly right. The documentation says
To clear all transforms of a Node, first clear its inherited transforms with clearNodeParent, then clear the local transform with clearNodeTransform.
So the application of this has to take the node hierarchy structure into account. And it might be that when doing that, the animation might work as expected. (I mean, the current result looks funny, but ā¦). Iāll try to have a closer look at this today.
A very quick test yields some pretty confusing results.
I created some hacky customClearNodeTransform, and applied it in a way so that only the translation part of the animated node is kept (so the scale of the animated node and the other root node are āclearedā). This causes the animation to still work. But the model also still disappears. (I would have thought that the scale of 0.01 in the root nodes might be a hot candidate. But ā¦ that doesnāt seem to be itā¦)
Another ā¦ ādata pointā: I noticed that itās possible to carefully tweak the view so that only parts of the model are disappearing:
This may look like a boring detail, but might actually give a hint about the place in the culling code where the bug is nesting: Whatever is happening there, itās not happening on the granularity of the model, but on the granularity of the āprimitivesā (meshes).
(Which is, frankly, even more confusing, because the āpillarā in this model has an identity transform, and it still disapparsā¦)
Testing with clearNodeParent (before clearNodeTransform) gives the same result: disappearing fixed, animation rotor not good. Hope to find a fix too for the animation.
It is possible to make the root transform the identity matrix, and still have the proper rotation (but also still have the issue of the model disappearing).
The node that contains the ārotorā must have translation, because that defines what the rotation is all about (i.e. the axis or rather local coordinate space).
OK. This is embarassing. Some of my previous statements did not make sense and/or have been plainly wrong. For some reason, I assumed that the I3DM refers to the GLB in the root directory. So I modified that GLB, and was surprised that the model still disappeared. But ā¦ yeah, that modified GLB was never loaded
(I now changed the I3DM to use a URI to refer to the GLB locally, so that I can test changes of the GLB more easily. Fortuntately, some of the pain-in-the-back debugging that I just went through would also have been necessary if the right model had been loadedā¦)
There are a few things left to investigate - for example, whether an I3DM that refers to a GLB that contains geometry in nodes that have different scaling even renders correctly.
A few levels higher, the question is whether the scaling factor (or more generally, the transform - details TBD) of a glTF node should affect the instancing transforms. When the instancing transforms come from EXT_mesh_gpu_instancing, then the node transform should affect them. When they come from āoutsideā, via an I3DM, then the node transform should not affect them (or at least, not in the way that it currently does).
Note to myself: Create an I3DM that contains a GLB that contains EXT_mesh_gpu_instancing. From what Iāve read so far in the code, Iām reasonably sure that this will breakā¦
Result: No error message, nothing gets drawn, 3d-tiles validator gives only info messages about not supported EXT_structural_metadata, EXT_mesh_gpu_instancing and EXT_instance_features
Donāt know if this scenario is supported or not (can image itās not because I3dm is deprecated), but if it is not supported I expect an error message (in Cesium client and/or validator).
While investigating this issue, I saw that āthe instancingā is internally accomplished with the same mechanism/structure, regardless of whether the instancing information comes from EXT_mesh_gpu_instancing or from the I3DM data. Soā¦ I suspected that they simply cannot be combined. One could argue back and forth here. Yes, I3DM is deprecated, but it is still used (and actually required for things like instanced animated models). And if it is a limitation, it should be clearly pointed out (and probably tracked in an issue, at least).