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

Update sample tilesets to version 1.0 #6857

Merged
merged 2 commits into from
Jul 30, 2018
Merged

Update sample tilesets to version 1.0 #6857

merged 2 commits into from
Jul 30, 2018

Conversation

lilleyse
Copy link
Contributor

For #6697

Updates all of the sample tilesets in Specs/Data/Cesium3DTiles to 3D Tiles 1.0 and glTF 2.0. Includes some bug fixes as well. @ggetz can you review?

CC CesiumGS/3d-tiles-validator#139

@lilleyse lilleyse requested a review from ggetz July 30, 2018 14:31
@cesium-concierge
Copy link

cesium-concierge commented Jul 30, 2018

Thanks for the pull request @lilleyse!

  • ✔️ Signed CLA found.
  • CHANGES.md was not updated.
    • If this change updates the public API in any way, please add a bullet point to CHANGES.md.
  • ❔ Changes to third party files were made.
    • Looks like 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.

Reviewers, don't forget to make sure that:

  • Cesium Viewer works.
  • Works in 2D/CV.
  • Works (or fails gracefully) in IE11.

I am a bot who helps you make Cesium awesome! Contributions to my configuration are welcome.

🌍 🌎 🌏

// E.g. texture2D(u_diffuse, uv)
// E.g. texture2D(u_diffuse, computeUV(index))
regex = new RegExp('texture2D\\(' + diffuseAttributeOrUniformName + '.*?(\\)\\)|\\))', 'g');
source = source.replace(regex, 'tile_diffuse_final($&, tile_diffuse)');
source = replaceDiffuseTextureCalls(source, diffuseAttributeOrUniformName);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The regex was too fragile before. It failed for a GLSL line from processPbrMetallicRoughness. Updated to support any number of nested parentheses.

Copy link
Contributor

Choose a reason for hiding this comment

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

I didn't see a spec update for this. Can we add a test with the offending line since it sounds like a good test case?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This code is tested in Cesium3DTilesetSpec with the colorBlendMode tests. I checked that this area of the code has 100% code coverage (the file is 99%).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sets colorBlendMode for textured tileset passes in master, fails without the replaceDiffuseTextureCalls fix, and passes with the replaceDiffuseTextureCalls fix. So no update is required.

gltf = parseBinaryGltf(gltf); // Updates to 2.0 and adds pipeline extras
addDefaults(gltf);
processModelMaterialsCommon(gltf);
processPbrMetallicRoughness(gltf);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added these lines because other code in ClassificationModel expected gltf.techniques to exist.

@ggetz you may need to add these changes to #6805 as well.

Copy link
Contributor

Choose a reason for hiding this comment

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

Noted in that PR.

if (gltf.asset.extras.gltf_pipeline_upgrade_10to20) {
addDefaultMaterial(gltf);
addDefaultTechnique(gltf);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is sort of a hack - this tells gltf-pipeline to only add default materials or techniques if the model was a 1.0 model. If the model has pbrMetallicRoughness these lines are not called. This was added to fix a test where 2 shaders were being created instead of 1.

This is temporary until #6805.

if (optimizeForCesium) {
var baseColorParameter = defaultValue(techniqueParameters.baseColorTexture, techniqueParameters.baseColorFactor);
if (defined(baseColorParameter)) {
baseColorParameter.semantic = '_3DTILESDIFFUSE';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is required for tileset.colorBlendMode to work for 2.0 models.

@@ -146,16 +145,4 @@ defineSuite([
});
});

it('renders with quantization', function() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed - no longer creating samples with glTF 1.0 extensions.

it('renders with textures', function() {
return Cesium3DTilesTester.loadTileset(scene, texturedUrl).then(function(tileset) {
Cesium3DTilesTester.expectRender(scene, tileset);
});
});

it('renders with compressed textures', function() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed - no longer testing compressed textures in 3D Tiles 1.0 until a better glTF extension comes around.

});
});

it('renders with a gltf z-up axis', function() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed - no longer supporting gltfUpAxis in 3D Tiles 1.0.

var geometryByteLength = 8880;
// 10 buildings, 36 ushort indices and 24 vertices per building, 8 float components (position, normal, uv) and 1 uint component (batchId) per vertex.
// 10 * ((24 * (8 * 4 + 1 * 4)) + (36 * 2)) = 9360
var geometryByteLength = 9360;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Due to glTF 2.0 restrictions on accessor layout, the _BATCHID accessor is now uint.

Other things that changed: textures are now 128x128 and uvs are removed from tilesets that aren't textured. Throughout there are changes to memory usage tests to account for this.

@@ -119,7 +119,7 @@ defineSuite([
var tilesetReplacementWithViewerRequestVolumeUrl = 'Data/Cesium3DTiles/Tilesets/TilesetReplacementWithViewerRequestVolume/tileset.json';

var tilesetWithExternalResourcesUrl = 'Data/Cesium3DTiles/Tilesets/TilesetWithExternalResources/tileset.json';
var tilesetUrlWithContentUri = 'Data/Cesium3DTiles/Tilesets/TilesetWithContentUri/tileset.json';
var tilesetUrlWithContentUri = 'Data/Cesium3DTiles/Batched/BatchedWithContentDataUri/tileset.json';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

3d-tiles-samples-generator was outputting as Batched/BatchedWithContentDataUri/tileset.json so I switched the url.

expect(rgba[2]).toEqual(0);
expect(rgba[0]).toBeGreaterThan(200);
expect(rgba[1]).toBeLessThan(25);
expect(rgba[2]).toBeLessThan(25);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The colors are updated since pbr shading doesn't produce the same sort of solid shading as before.

Copy link
Contributor

@ggetz ggetz left a comment

Choose a reason for hiding this comment

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

  • Cesium3DTileContent (and spec) are still checking content.url instead of content.uri. That should be updated correct? (I missed that in my first PR).

Otherwise looks good. Tests pass with for both source and release, and the updated tilesets all work in sandcastle and don't log errors to the console (unless they specifically have deprecated content).

// E.g. texture2D(u_diffuse, uv)
// E.g. texture2D(u_diffuse, computeUV(index))
regex = new RegExp('texture2D\\(' + diffuseAttributeOrUniformName + '.*?(\\)\\)|\\))', 'g');
source = source.replace(regex, 'tile_diffuse_final($&, tile_diffuse)');
source = replaceDiffuseTextureCalls(source, diffuseAttributeOrUniformName);
Copy link
Contributor

Choose a reason for hiding this comment

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

I didn't see a spec update for this. Can we add a test with the offending line since it sounds like a good test case?

@lilleyse
Copy link
Contributor Author

Cesium3DTileContent (and spec) are still checking content.url instead of content.uri. That should be updated correct? (I missed that in my first PR).

At least for this PR, let's keep it content.url. Maybe a future PR could address this with the usual deprecation period.

@ggetz
Copy link
Contributor

ggetz commented Jul 30, 2018

Ok, looks good to go then. Thanks @lilleyse !

@ggetz ggetz merged commit b83c2de into master Jul 30, 2018
@ggetz ggetz deleted the 1.0-tilesets branch July 30, 2018 19:47
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.

3 participants