Skip to content
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

Fix gltf pipeline for some 3d Tilesets #5783

Closed
wants to merge 6 commits into from

Conversation

jbo023
Copy link
Contributor

@jbo023 jbo023 commented Aug 25, 2017

Hi,
we had some problems with our 3D Tilesets with cesium cesium 1.36.
This pullrequest fixes these problems. The problems only concerns the GLTFPipeline code in Source/Thirdparty, so I am not sure if I should also create a pullrequest in the gltf-pipeline repo?`

Jannes

- only assign name to value if value is an object
- if gltf.assets.extras is already defined and not an object change to assets.extras.extras
@cesium-concierge
Copy link

@jbo023, thanks for the pull request!

I noticed that CHANGES.md has not been updated. If this change updates the public API in any way, fixes a bug, or makes any non-trivial update, please add a bullet point to CHANGES.md and comment on this pull request so we know it was updated. For more info, see the Pull Request Guidelines.

I noticed that a file in one of our ThirdParty folders (ThirdParty/, Source/ThirdParty/) has been added or modified. Please verify that it has a section in LICENSE.md and that its license information is up to date with this new version. Once you do, please confirm by commenting on this pull request.

I am a bot who helps you make Cesium awesome! Thanks again.

@lilleyse
Copy link
Contributor

Thanks @jbo023. Can you upload any problematic b3dm's so we can verify these fixes?

@jbo023
Copy link
Contributor Author

jbo023 commented Aug 25, 2017

@lilleyse you can use the two sandcastle demos I postet in the following issues,
#5477
#4368

If you want, i can also upload a zip file with one or two example datasets.

@mramato
Copy link
Contributor

mramato commented Aug 25, 2017

@lilleyse Since this is third-party code, shouldn't these changes go into the gltf-pipeline project first and then propagate to Cesium from there?

Copy link
Contributor

@lilleyse lilleyse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jbo023 like @mramato suggested it makes more sense to open a PR in gltf-pipeline. Make sure to target the 2.0 branch. The changes should still be shipped in 1.37.

I'm just leaving code comments here.

@@ -56,6 +56,12 @@ define([
gltf.extras._pipeline = defaultValue(gltf.extras._pipeline, {});
gltf.asset = defaultValue(gltf.asset, {});
gltf.asset.extras = defaultValue(gltf.asset.extras, {});
if(defined(gltf.asset.extras) && typeof(gltf.asset.extras) !== 'object'){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the glTF 1.0 spec extras should be an object, so I think the source data is invalid. However this change is ok for now, and the newer code on the cleanup branch of gltf-pipeline doesn't have this problem..

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah we are working on a new version of our 3d-tiles converter where we will fix these two bugs. But there are hundreds of legacy datasets we would still like to support.
When we finish the rewrite of our converter to GLTF 2.0 we are planning to tell our customers to reexport existing datasets.

@@ -225,7 +225,7 @@ define([
var value = object[id];
mapping[id] = array.length;
array.push(value);
if (!defined(value.name)) {
if (!defined(value.name) && typeof(value) === 'object') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at a glTF in http://hosting.virtualcitysystems.de/demos/temp/b3dm there is a samplerRepeat property at the top level of the glTF which isn't support by the spec. Ideally the source data should be fixed. Also fine with this change for now as this area too is changed in the cleanup branch.

@@ -17,6 +17,9 @@ define([
* @returns {Number} The byte stride of the accessor.
*/
function getAccessorByteStride(gltf, accessor) {
if(defined(accessor.byteStride) && accessor.byteStride !== 0){
return accessor.byteStride;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch here. This change probably belongs in updateVersion instead.

var bufferView = clone(bufferViews[oldBufferViewId]);
var accessorByteStride = (accessor.byteStride === 0) ? getAccessorByteStride(gltf, accessor) : accessor.byteStride;
if (defined(accessorByteStride)) {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved the check into updateversion, but i kept the defined check because I am not sure if accessor.byteStride is always defined?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah good point.

@lilleyse
Copy link
Contributor

lilleyse commented Sep 1, 2017

I merged these changes into gltf-pipeline: CesiumGS/gltf-pipeline#314.

Thanks @jbo023

@lilleyse lilleyse closed this Sep 1, 2017
@lilleyse lilleyse mentioned this pull request Sep 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants