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

Support vertex colors for materialsCommon and pbrMetallicRoughness #6089

Merged
merged 15 commits into from
Jan 10, 2018

Conversation

lilleyse
Copy link
Contributor

@lilleyse lilleyse commented Jan 5, 2018

Adds support for rendering vertex colors on models using the COLOR_0 vertex attribute. Includes gltf-pipeline changes from CesiumGS/gltf-pipeline#345.

Besides just rounding out our gltf implemenation this was added so that we can introduce a proper test case for #5874.

TODO:

  • Tests

@cesium-concierge
Copy link

Signed CLA is on file.

@lilleyse, thanks for the pull request! Maintainers, we have a signed CLA from @lilleyse, so you can review this at any time.

⚠️ 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! Contributions to my configuration are welcome.

🌍 🌎 🌏

@pjcozzi
Copy link
Contributor

pjcozzi commented Jan 6, 2018

@emackey any interest in reviewing this?

Copy link
Contributor

@emackey emackey left a comment

Choose a reason for hiding this comment

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

Vertex colors appear to work on materials where they're needed, but on my test model they cancelled out another material that wasn't using them.

ForEach.meshPrimitive(mesh, function(primitive) {
ForEach.meshPrimitiveAttribute(primitive, function(attribute, semantic) {
if (semantic.indexOf('COLOR') === 0) {
hasVertexColors = true;
Copy link
Contributor

Choose a reason for hiding this comment

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

Individual materials are allowed to have, or not have, vertex colors. This branch appears to apply hasVertexColors globally to a model, so if one material is using them, the others go dark (by multiplying by zero apparently, in my testing).

Haven't tried this, but could you make the default color white, so if hasVertexColors is true but a particular material doesn't have COLOR_0, it acts as if it had white vertices instead of black?

@lilleyse
Copy link
Contributor Author

Updated:

updated

@lilleyse lilleyse changed the base branch from color-blend-mode-doc to master January 10, 2018 05:10
@lilleyse
Copy link
Contributor Author

I merged master into this branch and added tweaks/fixes for vector tiles. I decided to just close the previous PR (#5874) because it's not worth fixing the merge conflict again but for that branch.

@@ -52,12 +52,15 @@ define([
};
};

ModelUtility.getAttributeOrUniformBySemantic = function(gltf, semantic) {
ModelUtility.getAttributeOrUniformBySemantic = function(gltf, semantic, programId) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Am I missing something here? I don't see parameter semantic being used in this 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.

It's being used: defined(parameter) && parameter.semantic === semantic

@lilleyse
Copy link
Contributor Author

@bagnell can you review the 3D Tiles aspects of this?

@bagnell
Copy link
Contributor

bagnell commented Jan 10, 2018

This looks good to me. @emackey, is this good to merge?

Copy link
Contributor

@emackey emackey left a comment

Choose a reason for hiding this comment

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

Yep thanks!

@emackey
Copy link
Contributor

emackey commented Jan 10, 2018

Tests pass on my local box, but Travis has a failure. Still OK to merge?

@bagnell
Copy link
Contributor

bagnell commented Jan 10, 2018

Yep, the test failure is an unrelated timeout from an imagery provider. Merging.

@bagnell bagnell merged commit 3c9e832 into master Jan 10, 2018
@bagnell bagnell deleted the vertex-colors branch January 10, 2018 20:48
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.

5 participants