Add Khronos glTF sample models to fidelity test suite#375
Conversation
7164807 to
ba08948
Compare
ba08948 to
046b433
Compare
046b433 to
917251c
Compare
|
Excited to see these tests set up, thanks! :) Texture transforms The description suggests Filament is correct on offset/scale and incorrect on rotation, but I think all three are wrong – looks like Filament doesn't implement that extension yet. Multiple UVs ThreeJS does support multiple UVs for the most common case – AO maps. But arbitrary textures can't be assigned to arbitrary UV maps, which is what this test shows, so that's a known issue. Alpha blending This is unexpected – I've commented on #381. Overall – the staging looks similar on these, but the lighting does not. I can't tell from the PR if that's expected. In particular |
Good call, will fix the description.
Is there an issue we can reference from here?
👍
Yeah, definitely. There was a bit of background discussion that I should have linked to that occurred during the PMREM change: #338 I'll include a brief summary in the PR description. |
|
scripts/model-viewer-screenshot.js
Outdated
| process.exit(1); | ||
| } | ||
|
|
||
| screenshotCreator |
There was a problem hiding this comment.
For top level promise usage, I like to wrap an async iife (async function(){ ... })() to use async await.. which now I mention it, it's been awhile, I think node has native async awaits now.
| pushd $FILAMENT_DIR | ||
|
|
||
| git fetch --depth=1 origin | ||
| #git fetch --depth=1 origin |
There was a problem hiding this comment.
Removed by accident (couldn't git fetch from the commuter ferry 🙃)
package.json
Outdated
| "compare-fidelity": "./scripts/compare-fidelity-to-ref.sh", | ||
| "install-renderers": "./scripts/install-third-party-renderers.sh", | ||
| "update-screenshots": "node ./scripts/update-screenshots.js", | ||
| "checkout-samples": "./scripts/checkout-khronos-gltf-samples.sh", |
There was a problem hiding this comment.
nit, maybe get-samples or fetch-samples is a bit more obvious at what this does
| REPO_URL=https://github.com/KhronosGroup/glTF-Sample-Models.git | ||
| CLONE_PATH=./examples/assets/glTF-Sample-Models | ||
|
|
||
| if [ ! -d "$CLONE_PATH/.git" ]; then |
There was a problem hiding this comment.
Maybe a warning here, or in the README, that this will pull down a large amount of data
There was a problem hiding this comment.
Good call, will fix 👍
There was a problem hiding this comment.
There is a warning in both places now.
90ab4f0 to
f34260a
Compare
README.md
Outdated
| * `npm test` - Runs tests. | ||
| * `npm run check-fidelity` - Compare rendering to third-party renderers | ||
| * `npm run install-renderers` - Install or update third-party renderers | ||
| * `npm run fetch-samples` - Create or update a local copy of sample models. This is needed for running fidelity checks and updating screenshots. Warning: the samples are hundreds of megabytes large in aggregate! |
There was a problem hiding this comment.
If this is required, does it make sense to merge fetch-samples in with (perhaps) install-renderers (another long, expensive prep step) into a single script named something like prepare-fidelity?
There was a problem hiding this comment.
Or, if the thinking is that this is always run in npm install, maybe mention that (or leave it out entirely?)
There was a problem hiding this comment.
I guess for factorization purposes it would be nice to keep these things separated. For usability purposes, we probably want a single command.
It's easy enough for us to make a combined command and just not document the sub-commands.
I'm also happy to leave it out entirely.
There was a problem hiding this comment.
Agreed re factorization, I think particularly the backend scripts (the .sh or .js files) having those split and encapsulated helps to understand the code.
I like both a combined commands and undocumented sub-commands (I've used a - prefix to connotate internal sub-commands) or leaving that sub-commands out entirely.
The thing I like most is having the combined command for usability.
There was a problem hiding this comment.
Not a blocker to a merge, though.
There was a problem hiding this comment.
Added a command called npm run bootstrap-fidelity-dev that checks out samples and builds filament in one go. Removed docs for the individual fetch / install tasks.
f34260a to
0e8c1f4
Compare
0e8c1f4 to
579cd37
Compare
Khronos glTF sample fidelity tests
This change proposes the addition of several tests to the fidelity suit, all based on Khronos glTF sample models. The highlights of this change include:
<model-viewer>"master" screenshotsnpm run update-screenshotswill update Filament and<model-viewer"master" at the same timegltf_rendererupdated to use the same model framing strategy as<model-viewer>going forwardnpm run checkout-sampleswill clone and/or update Khronos samples directly from Githubnpm installandnpm ci🛂Note for reviewers: these tests bring attention to a noticeable lighting / saturation difference between Filament and
<model-viewer>for many of the cases. This is currently expected, and is assumed to be due to default lighting, tonemapping and exposure configurations across both renderers. For relevant background discussion, please refer to #338, where PMREM support was introduced.Analysis of initial results
16bpc PNG textures
The first model to show a disparity is Antique Camera:
<model-viewer>gltf_rendererI dug into this problem and discovered that Filament was failing to load some of the model's textures because it was using a third-party library that did not support loading 16bpc PNGs. A fix for this issue has already landed in Filament, so thankfully this particular disparity should be gone by the time we update the screenshots again.
Vertex colors
The next stand-out issue is that for an as-yet undiagnosed reason, Filament does not support vertex colors in glTFs yet. This issue is already documented by the Filament project (google/filament#528). Here are the results for the two fidelity tests that check for vertex color support:
<model-viewer>gltf_rendererTexture transforms
The Khronos body includes a sample model that tests support for the
KHR_texture_transformextension. Filament shows an incorrect result for scale, transform and rotation (subsequent discussion on Filament project suggests this will be fixed by changing their glTF loader):<model-viewer>gltf_rendererMultiple UVs
One of the notable gaps in
<model-viewer>'s glTF support that is uncovered by these tests is the lack of multiple UV support (#372 filed to track). Filament's render matches the expected result in this case:<model-viewer>gltf_rendererNormal tangents
The glTF samples include two test cases (1, 2) related to normal tangents. The mirrored case tests whether the tangents supplied by the model are used (as opposed to the tangents being calculated by the renderer). The mirrored case is notably incorrect in Filament (already documented in google/filament#528):
<model-viewer>gltf_rendererUnlit materials
These tests uncovered that
<model-viewer>completely fails to do the right thing with unlit materials (#374 filed to track). Thankfully, @jsantell has already put a fix (#377) up for consideration. Here is an example of the current rendering failure (Filament's render result is what we expect):<model-viewer>gltf_rendererAlpha blending
The Khronos models include a test case for alpha blending. These render results surprised me:
<model-viewer>seems to yield an incorrect result in all columns except for the second one (filed #381 to track). Filament renders the expected result:<model-viewer>gltf_rendererOther inconsistencies
There were a few render results where there were obvious inconsistencies or rendering artifacts, but the cause is less certain.
🛂Reviewers: please consider the following cases and speculate about what might be causing these inconsistencies and whether we can/should take action to address them:
Environment Test
The bottom row seems very different.
<model-viewer>seems closer to the result shown in the Khronos source repo:<model-viewer>gltf_rendererOrientation Test
Particularly I want to call out the weird flecks of white on our render:
<model-viewer>gltf_rendererStaging models in
gltf_rendererIn our initial effort to compare
<model-viewer>to other renderers, we hand-crafted tests and manually captured screenshots. In the course of doing this, we were lucky that Filament and<model-viewer>happened to stage certain models with near-pixel-perfect camera projection and relative positioning. For example, consider this fidelity test added in #361 :Unfortunately, this coincidence of staging strategies is just that: a coincidence. After adding the battery of Khronos sample model tests, it became immediately obvious that many types of models were not staged the same way by both renderers.
So, this change includes a modification of our Filament-based
gltf_renderer. Model staging has been updated to closely match the strategy used by<model-viewer>'s ownModelScene:https://github.com/GoogleWebComponents/model-viewer/blob/917251cb8fd1f65508078895862f22ac0504567a/src/three-components/ModelScene.js#L163-L204
https://github.com/GoogleWebComponents/model-viewer/blob/917251cb8fd1f65508078895862f22ac0504567a/src/three-components/ModelScene.js#L214-L240
Our Filament screen captures will now be staged as expected. Hopefully this change will allow us to easily/coherently adapt our Filament staging over time as we change
<model-viewer>as well.Follow-on work
The following issues have been filed during the course of work on this change, and represent follow-on work towards improved compatibility/conformance of
<model-viewer>and consistency across renderers:<model-viewer>fails to render glTFs w/ animationsgltf_viewerFixes #360