-
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
Update sample tilesets to version 1.0 #6857
Conversation
Thanks for the pull request @lilleyse!
Reviewers, don't forget to make sure that:
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); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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%).
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
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); | ||
} |
There was a problem hiding this comment.
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'; |
There was a problem hiding this comment.
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() { |
There was a problem hiding this comment.
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() { |
There was a problem hiding this comment.
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() { |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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'; |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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.
There was a problem hiding this 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 checkingcontent.url
instead ofcontent.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); |
There was a problem hiding this comment.
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?
At least for this PR, let's keep it |
Ok, looks good to go then. Thanks @lilleyse ! |
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