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

Added KHR_materials_common materials/techniques/shaders to addDefaults #55

Merged
merged 4 commits into from
Jun 7, 2016

Conversation

likangning93
Copy link
Contributor

@JoshuaStorm and I wrote this to have defaultMaterials try to match the existing gltf material values to one of the KHR_materials_common materials, apply the appropriate extension, and then pass the gltf to modelMaterialsCommon at the end of addDefaults.

Also added some tests to addDefaultsSpec.

See #1

@coveralls
Copy link

Coverage Status

Coverage increased (+1.0%) to 93.274% when pulling 502e3e3 on materialsStageKHR into 3db3306 on master.

@pjcozzi
Copy link
Contributor

pjcozzi commented Jun 3, 2016

@lilleyse can you please do an initial review here?

@coveralls
Copy link

Coverage Status

Coverage decreased (-5.6%) to 86.717% when pulling 1e68c45 on materialsStageKHR into 3db3306 on master.

@likangning93
Copy link
Contributor Author

Updated. When testing assimp exported gltf (gltf without techniques) we ran into a problem where cesium's modelMaterialsCommon would produce shaders with empty string uris. We got around it with a customized modelMaterialsCommon in the lib folder, similar to what's in OBJ2GLTF.

Unfortunately assimp exported gltfs still don't seem to work, but the test case we've been using is also weird. It has buffer views for indices, positions, normals, and uvs but they all point at the same buffer and all have offset 0. Very strange. See attached.

assimp.zip

@pjcozzi
Copy link
Contributor

pjcozzi commented Jun 3, 2016

For assimp, have you tried just the box COLLADA model, https://github.com/KhronosGroup/glTF/tree/master/sampleModels/Box/collada

@likangning93
Copy link
Contributor Author

I gave it a try, but it seems to have the same problem with the bufferViews. It actually runs into the same error in the pipeline and when I try to view it in the online COLLADA to glTF convertor.

@pjcozzi
Copy link
Contributor

pjcozzi commented Jun 3, 2016

What about using a simple OBJ file with assimp, perhaps from https://github.com/SaschaWillems/Vulkan/tree/master/models

Just trying to understand if it is the assimp importer or assimp glTF exporter.

@likangning93
Copy link
Contributor Author

I tried it with a basic cube and with hammardillo, but it seems to be the same problem, bufferViews that all start at 0.

@likangning93
Copy link
Contributor Author

I'm pretty sure it's in the assimp gltf exporter. I'm going to try and take a look at their code.

@pjcozzi
Copy link
Contributor

pjcozzi commented Jun 3, 2016

If you figure it out in a reasonable amount of time, open a pull request; otherwise, some an issue to the assimp repo and include sample data and simple instructions to reproduce it.

@@ -0,0 +1,300 @@
"use strict";
Copy link
Contributor

Choose a reason for hiding this comment

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

Talked offline, but you use Cesium's defined, defaultValue, and WebGLConstants instead for modelMaterialsCommon.

…onstants, adjusted some KHR_materials_common items, fixed some logic errors
@likangning93
Copy link
Contributor Author

Ok. Updated!

@lilleyse
Copy link
Contributor

lilleyse commented Jun 4, 2016

Nice, looks good!

@coveralls
Copy link

Coverage Status

Coverage decreased (-5.0%) to 87.336% when pulling ddba592 on materialsStageKHR into 3db3306 on master.

@lilleyse
Copy link
Contributor

lilleyse commented Jun 4, 2016

@pjcozzi this is ready whenever you want to look

typeof(value[3]) === 'number') {
return value;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

To follow our style guide, just write

return [0, 0, 0, 1];

And drop the else; it is not needed.

@pjcozzi
Copy link
Contributor

pjcozzi commented Jun 4, 2016

Looks like test coverage could be improve a good bit: https://coveralls.io/github/AnalyticalGraphicsInc/gltf-pipeline?branch=materialsStageKHR

@coveralls
Copy link

Coverage Status

Coverage increased (+1.5%) to 93.815% when pulling 9d7cf7c on materialsStageKHR into 3db3306 on master.

@likangning93
Copy link
Contributor Author

Updated! Apparently I misunderstood extensions versus extensionsUsed, so fixing that and adding some more to the tests I had helped increase the coverage.

@pjcozzi
Copy link
Contributor

pjcozzi commented Jun 6, 2016

@lilleyse please merge when ready.

@lilleyse
Copy link
Contributor

lilleyse commented Jun 7, 2016

Looks ready to me.

@lilleyse lilleyse merged commit 8a6f4bb into master Jun 7, 2016
@pjcozzi
Copy link
Contributor

pjcozzi commented Jun 7, 2016

I deleted the branch. @lilleyse please delete branches after merging just like the Cesium repo.

@pjcozzi pjcozzi deleted the materialsStageKHR branch June 7, 2016 16:07
@lilleyse
Copy link
Contributor

lilleyse commented Jun 7, 2016

Ah forgot, thanks!

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