-
Notifications
You must be signed in to change notification settings - Fork 250
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 version -> 2.0 (#271) #272
Conversation
* Added updateVersion stage as well as some refactoring * Split out into multiple functions * Cleaned up a few failing tests * Added new upgrades to specs * Application specific parameters are prefixed with underscores * Migrated changes back from cesium * Changed 1.1 to 2.0 * Lots of 1.0->2.0 changes in pipeline stages * Tweaks from model generation * Generate default material * Add updateVersion to buildForCesium * Select default scene * A few more small changes * Add removePipelineExtras to cesium build * kmc fixes * Build global cesium include * Update * Update CHANGES.md * Added two more update functions * Update CHANGES.md * Strip version numbers when guessing if invalid * WIP Array-based Traversal * More WIP changes * Removed combineMeshes -> nodes only have a singular mesh now * Operator -> operate * combineNodes, removeUnused and dagToTree traversal changes * More WIP * Bulk WIP changes for traversal * Fixed a few more failing tests * Removed findUsedIds * WIP, switching workspaces * WIP, pretty much just AO left * Fixed a few more tests * All tests pass * Removed riggedSimpleUnoptimized * Delete generateTangentsBitangents models * Don't look for slots in array, just append * Small fixes from testing * More fixes * A few test fixes and byteStride -> bufferView * A few more test fixes * Missed a function * Removed vestigial byteStride references * Some fixes from cesium changes * Fixed cesium dependency list * Fixed some plurality issues * Add KHR_technique_webgl extensions if there are techniques
pbr->materialsCommon generation
lib/uninterleaveAndPackBuffers.js
Outdated
accessor.bufferView = accessor.extras._pipeline.bufferView; | ||
// compute the total size for each arraybuffer type | ||
ForEach.accessor(gltf, function (accessor) { | ||
var bufferView = gltf.bufferViews[accessor.bufferView]; |
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.
@lasalvavida I think in the most recent spec. Accessor doesn't have to have a bufferView property?
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.
Thanks for the review, @fanzhanggoogle! You are correct, see KhronosGroup/glTF#863
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.
@fanzhanggoogle you are correct, however the only situation where an accessor doesn't have a bufferView property is if it is a sparse accessor. That isn't something that we support here yet, however a guard to make sure it is defined may be a good idea.
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.
Yes, I agree with using a guard here. Just a note, cctually in the most recently 2.0 spec, there is:
"When nor sparse, neither bufferView is defined, min and max properties could have any values. This is intended for use cases when binary data is supplied by external means (e.g., via extensions)."
Which means bufferView
could just be omitted.
lib/uninterleaveAndPackBuffers.js
Outdated
accessorIds.push(accessorId); | ||
} | ||
} | ||
var bufferViews = [{ |
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.
In this file, it packs all the bufferViews if they are belong to an accessor and write over the original array of bufferViews. However, if there are some bufferViews are not belong to any accessor, e.g. is a property of an extension, then it won't work.
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.
@fanzhanggoogle, that is a good point, but I'm not really sure how to work around it, since you'll have the same problem with the removeUnused
functions as well. This is an optimization pipeline after all. I think the best solution we have is to support known extensions. So whichever extension specifies a bufferView will also be checked and added here.
If your example use case comes from the mesh compression you guys have been working on, I would be happy to add support based on an extension spec draft.
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.
Sounds good! Thanks. I'm actually working on a branch to add support for the mesh compression extension in glTF-pipeline, I'll make a PR once it's done. It would be great to have you review it.
I agree with you that supporting known extension is enough here.
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 has a lot of much needed cleanup in it! I plan on testing more thoroughly later.
Some other differences in the spec that should be handled:
JOINT
andWEIGHT
are nowJOINTS_0
andWEIGHTS_0
.byteStride
is now required- Empty arrays are disallowed now. There are probably corner cases throughout the code related to this.
function getAccessorByteStride(accessor) { | ||
if (accessor.byteStride > 0) { | ||
return accessor.byteStride; | ||
function getAccessorByteStride(gltf, accessor) { |
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.
gltf
is missing from the doc
@@ -44,6 +45,7 @@ function addCesiumRTC(gltf, options) { | |||
extensions.CESIUM_RTC = { |
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.
Hidden from the diff:
var extensions = gltf.extensions;
if (!defined(extensions)) {
extensions = {};
gltf.extensions = extensions;
}
I noticed a few others areas like this and thought it could benefit from a smaller helper file.
@@ -6,6 +6,7 @@ var Ellipsoid = Cesium.Ellipsoid; | |||
var defaultValue = Cesium.defaultValue; |
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 file can use ForEach.technique
and ForEach.techniqueParameters
.
], | ||
asset : {}, | ||
buffers : [ | ||
{ | ||
byteLength: 0, | ||
type: 'arraybuffer' |
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 should be removed.
], | ||
asset : {}, | ||
buffers : [ | ||
{ | ||
byteLength: 0, |
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.
byteLength
now has a minimum of 1.
function glTF10to20(gltf) { | ||
if (!defined(gltf.asset)) { | ||
gltf.asset = {}; | ||
} |
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 check here and in gltf08to10
aren't required since asset
is always created initially.
lib/updateVersion.js
Outdated
var skeletons = node.skeletons; | ||
var skeletonsLength = skeletons.length; | ||
if (skeletonsLength > 0) { | ||
node.skeleton = globalMapping.nodes[skeletons[0]]; |
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.
As noted before, skeleton
is now part of skin
.
if (topLevelId === 'animations') { | ||
objectMapping = {}; | ||
object.samplers = objectToArray(object.samplers, objectMapping); | ||
globalMapping[topLevelId].samplers = objectMapping; |
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.
Isn't this handled below?
lib/updateVersion.js
Outdated
var bufferView = gltf.bufferViews[accessor.bufferView]; | ||
if (defined(bufferView.byteStride) && bufferView.byteStride !== byteStride) { | ||
// another accessor uses this with a different byte stride | ||
bufferView = clone(bufferView); |
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.
Bit of a nitpick, but in the case of the presence of an extras
objects clone
should be a deep clone.
var yfov = perspective.yfov; | ||
if (defined(yfov) && yfov === 0.0) { | ||
perspective.yfov = 1.0; | ||
} |
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.
Why 1.0
?
|
…gets Infer missing bufferView targets
…t removes textures from gltf
Hi @lilleyse @lasalvavida , I was wondering if the PR is still active. Which is the active glTF-pipeline repo for glTF2.0? Thanks! |
This PR hasn't been visibly active, but there is a separate pull request coming in here soon. A lot of the code here will also be used in Cesium for converting 1.0 models to 2.0. Long term however, this PR will stay parked on a branch until a full cleanup is complete that puts gltf 2.0 first. The working branch for that is |
Thanks. Good to know! |
Closing - but the keeping the branch alive since this is the basis for Cesium's implementation. Development for 2.0 will now be on the |
@lilleyse, @pjcozzi, this is the PR for merging 2.0 into master