-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gltf node instancing not supported in Cesium. #1754
Comments
Thanks for the report @vinjn |
@pjcozzi Do you have clues on how to debug this issue? I can look into this problem myself with your instructions. |
Thanks for the kind offer. In Model.js, have a look at parseNodes() and createRuntimeNodes(). |
I have investigated these methods, however no clues have been found so far. |
https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Source/Scene/Model.js#L1833-L1845 // Node hierarchy is a DAG so a node can have more than one parent so it may already exist
var runtimeNode = runtimeNodes[n.id];
if (runtimeNode.parents.length === 0) {
if (defined(gltfNode.matrix)) {
runtimeNode.matrix = Matrix4.fromColumnMajorArray(gltfNode.matrix);
} else {
// TRS converted to Cesium types
axis = Cartesian3.fromArray(gltfNode.rotation, 0, axis);
runtimeNode.translation = Cartesian3.fromArray(gltfNode.translation);
runtimeNode.rotation = Quaternion.fromAxisAngle(axis, gltfNode.rotation[3]);
runtimeNode.scale = Cartesian3.fromArray(gltfNode.scale);
}
} It seems the transformation fileds of runtimeNode is only updated when gltfNode is parsed for the first time |
This could be the issue. If a node has more than one parent, we should create a new It could be a small fix, but I don't have the bandwidth to look at it right now. Do you want to experiment? |
I would love to have that challenge. When shall we create new
|
I think that will do it. Essentially, in |
Thanks again @vinjn. This is a good catch since Cesium was trying to handle this case but was not doing so correctly; it had a separate draw call for each instanced node, but they all used the "last" parent's transform. I hacked up a partial fix in gltf-instancing but it is ugly and only works for multiple immediate parents, not older ancestors. Instead, I'm pretty sure I am going to expand the glTF DAG into a tree, but this will be some work since I will need to map the original glTF node ids (e.g., for animation and show/hide) to the new nodes. @fabrobinet I imagine this is how your renderer works? |
I confirm but it's not a big overhead as you can share the same geometry. |
Agreed, I'm not concerned about the overhead, just the time I need to update the code :) |
@satishkashyap also reported this bug with a different model: KhronosGroup/glTF#363 |
Fixing this might also fix #2387. |
I'm also running into this issue when trying to convert some models. From the glTF issue it seems like the plan is to fix this at the converter level? |
Exactly, this will be fixed in the converter. We decided that the glTF spec will not allow DAGs, so DAGs will be converted to a tree offline. See KhronosGroup/glTF#401 This conversion will be part of CesiumGS/gltf-pipeline#1. Work will begin in the new year. |
KhronosGroup/glTF#276
Dae file uploaded as https://cloud.githubusercontent.com/assets/558657/3093329/694702ee-e5b1-11e3-9c48-138430dd89c6.jpg
You can download the
jpg
, and rename the extension to7z
and extract it.The expected rendering result should be like
However the result from Cesium is like
The text was updated successfully, but these errors were encountered: