Skip to content

Commit

Permalink
Update Filament to 1.31.5 and re-render goldens (google#4138)
Browse files Browse the repository at this point in the history
* Update Filament to 1.31.5 and re-render goldens

* Run npm i

* Bump Filament version and npm i
  • Loading branch information
bejado authored Feb 22, 2023
1 parent 28497c2 commit ca3f198
Show file tree
Hide file tree
Showing 90 changed files with 36 additions and 14 deletions.
26 changes: 22 additions & 4 deletions packages/render-fidelity-tools/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/render-fidelity-tools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"@types/puppeteer": "^5.4.6",
"@types/rimraf": "^3.0.1",
"@types/three": "^0.148.0",
"filament": "1.12.2",
"filament": "1.31.5",
"focus-visible": "^5.2.0",
"http-server": "^14.1.1",
"lit": "^2.2.3",
Expand All @@ -56,4 +56,4 @@
"rollup-plugin-external-globals": "^0.6.1",
"typescript": "4.8.4"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ const basepath = (urlString: string): string => {
return url.toString();
};

const IS_BINARY_RE = /\.glb$/;

const $engine = Symbol('engine');
const $scene = Symbol('scene');
const $ibl = Symbol('ibl');
Expand Down Expand Up @@ -217,14 +215,14 @@ export class FilamentViewer extends LitElement {
this[$scene].addEntity(directionalLight);
} else {
await fetchFilamentAssets([iblUrl, skyboxUrl]);
const ibl = this[$engine].createIblFromKtx(iblUrl);
const ibl = this[$engine].createIblFromKtx1(iblUrl);
this[$scene].setIndirectLight(ibl);
this[$ibl] = ibl;
ibl.setIntensity(1.0);
ibl.setRotation([0, 0, -1, 0, 1, 0, 1, 0, 0]); // 90 degrees

if (scenario.renderSkybox) {
this[$skybox] = this[$engine].createSkyFromKtx(skyboxUrl);
this[$skybox] = this[$engine].createSkyFromKtx1(skyboxUrl);
this[$scene].setSkybox(this[$skybox]);
} else {
this[$view].setBlendMode(View$BlendMode.TRANSLUCENT);
Expand All @@ -238,9 +236,7 @@ export class FilamentViewer extends LitElement {
}
const loader = this[$assetLoader]!;

this[$currentAsset] = IS_BINARY_RE.test(modelUrl) ?
loader.createAssetFromBinary(modelUrl) :
loader.createAssetFromJson(modelUrl);
this[$currentAsset] = loader.createAsset(modelUrl);

const asset = this[$currentAsset]!;

Expand All @@ -249,6 +245,9 @@ export class FilamentViewer extends LitElement {
asset.loadResources(resolve, () => {}, basepath(modelUrl), 1);
});

// Since asset.loadResources() has finished; it's safe to call releaseSourceData.
asset.releaseSourceData();

this[$boundingBox] = asset.getBoundingBox();
const entities = asset.getEntities();
this[$scene].addEntities(entities);
Expand Down Expand Up @@ -322,7 +321,12 @@ export class FilamentViewer extends LitElement {
const {min, max} = this[$boundingBox]!;
const modelRadius =
Math.max(max[0] - min[0], max[1] - min[1], max[2] - min[2]);
const far = 2 * Math.max(modelRadius, orbit.radius);
const maxRadius = Math.max(modelRadius, orbit.radius);

// Compute the near and far for the camera projection.
// far and near must be > 0, otherwise Filament throws an error.
// This can happen at initialization before the asset is loaded.
const far = maxRadius > 0 ? 2 * maxRadius : 10.0;
const near = far / 1000;

const camera = this[$camera];
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ca3f198

Please sign in to comment.