Skip to content

Commit

Permalink
Precise framing (google#755)
Browse files Browse the repository at this point in the history
* camera distance no longer depends on aspect ratio

* reframing aspect ratio using FOV

* cleanup

* precise framing over vertices

* refactored, docs added

* adding tests

* fixed typo

* added more tests

* cleanup

* updated docs

* reducing diff

* added attribution

* can now specify radius in %

* starting to convert fidelity tests to configure the scene with the config file

* updated the first few scenarios

* updated filament to use config staging

* updated fidelity configs

* updated screenshots, framing inconsistency remains

* addressing feedback

* addressing more feedback

* updated to latest filament release

* fixed stupid bugs

* updated fidelity images

* reset max polar angles

* Simplify deserializeSpherical

* addressing feedback

* updated conversion docs

* camera now works with radius=0

* specify fov in fidelity tests

* updated fidelity screenshots

* run single fidelity check

* fixing travis fidelity testing

* Increase model load timeout (google#783)

* Force canvas onto its own render layer (google#785)
  • Loading branch information
elalish authored and Christopher Joel committed Sep 30, 2019
1 parent 14fe4bd commit b28f16d
Show file tree
Hide file tree
Showing 119 changed files with 663 additions and 530 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ run build separately to pick up the changes.
* `npm run fetch-samples` - Pull the Khronos sample models for fidelity testing.
Note: This will download hundreds of megabytes of data the first time you run it.
* `npm run check-fidelity` - Compare rendering to third-party renderers.
* `npm run update-screenshots` - Take screenshots of fidelity tests using third-party renderers.
* `npm run update-screenshots` - Take screenshots of fidelity tests using third-party renderers. If you get an error about not having `convert`, make sure to install Image Magick, e.g. on OSX run `brew install imagemagick`.

## Examples

Expand Down
45 changes: 26 additions & 19 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -161,17 +161,18 @@ <h3 class="grouping-title">Attributes</h3>
</li>
<li>
<div>camera-orbit</div>
<p>Set the starting and/or subsequent orbital position of the camera.
You can control the azimuthal and polar angles, and the distance
from the model. Accepts values of the form "$angle $angle $distance",
like "10deg 75deg 1.5m". Also supports units in radians ("rad") for
angles and centimeters ("cm") or millimeters ("mm") for camera
distance. A special value "auto" can be used for the distance, which
sets the distance to the ideal framing distance based on the
responsive scaling applied to the model scene. Any time this value
changes from its initially configured value, the camera will
interpolate from its current position to the new value. Defaults to
"0deg 75deg auto".</p>
<p>Set the starting and/or subsequent orbital position of the
camera. You can control the azimuthal and polar angles, and the
distance from the model. Accepts values of the form "$angle $angle
$distance", like "10deg 75deg 1.5m". Also supports units in
radians ("rad") for angles and centimeters ("cm") or millimeters
("mm") for camera distance. Camera distance can also be set as a
percentage ('%'), where 100% gives the model tight framing within
any window based on all possible theta and phi values. Any time
this value changes from its initially configured value, the camera
will interpolate from its current position to the new value.
Defaults to "0deg 75deg 105%". Any value set to 'auto' will revert
to the default.</p>
</li>
<li>
<div>camera-target</div>
Expand All @@ -198,17 +199,23 @@ <h3 class="grouping-title">Attributes</h3>
</li>
<li>
<div>field-of-view</div>
<p>Used to configure the field of view of the camera. Accepts values
units in both degrees and radians (e.g., "30deg" or "0.5rad"). Accepts
any value between 20 and 45 degrees. Defaults to "45deg".</p>
<p>Used to configure the vertical field of view of the camera.
Accepts values units in both degrees and radians (e.g., "30deg" or
"0.5rad"). Accepts any value between 10 and 45 degrees. Any time
this value changes from its initially configured value, the camera
will interpolate from its current value to the new value. Defaults
to "auto", which sets either the vertical or horizontal field of
view to 45 degrees depending on the dimenions of the model and the
aspect ratio of the canvas.</p>
</li>
<li>
<div>interaction-policy</div>
<p>Allows you to change whether the viewer requires focus before interacting with it.
If set to "allow-when-focused", the user must focus on the viewer (click / tap)
before being able to control it. If set to "always-allow", the user can
control it even if the viewer is not the focused element on the page.
Defaults to "always-allow".</p>
<p>Allows you to change whether the viewer requires focus before
interacting with it. If set to "allow-when-focused", the user must
focus on the viewer (click / tap) before being able to control it.
If set to "always-allow", the user can control it even if the
viewer is not the focused element on the page. Defaults to
"always-allow".</p>
</li>
<li>
<div>interaction-prompt</div>
Expand Down
22 changes: 11 additions & 11 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
"concurrently": "^4.0.1",
"cross-os": "^1.3.0",
"esm": "^3.0.84",
"filament": "1.3.1-b",
"filament": "1.3.2",
"focus-visible": "^5.0.1",
"fullscreen-polyfill": "^1.0.2",
"intersection-observer": "^0.5.1",
Expand Down
2 changes: 1 addition & 1 deletion scripts/run-fidelity-check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# limitations under the License.
#

if [[ "${TEST_TYPE}" = "fidelity" || ("${TRAVIS_BRANCH}" = "master" && "${TRAVIS_PULL_REQUEST}" = "false") ]]; then
if [[ "${TEST_TYPE}" = "fidelity" && "${TRAVIS_PULL_REQUEST}" = "false" ]]; then
npm run build
npm run check-fidelity
fi
11 changes: 9 additions & 2 deletions scripts/update-screenshots.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
* limitations under the License.
*/

require = require('esm')(module);
const {ConfigReader} = require('../lib/test/fidelity/config-reader.js');

const fs = require('fs').promises;
const {spawn} = require('child_process');
const path = require('path');
Expand Down Expand Up @@ -76,8 +79,12 @@ const updateScreenshots = async (config) => {
// Ignored...
}

for (const scenario of scenarios) {
const {name: scenarioName, model, lighting, dimensions, exclude} = scenario;
const configReader = new ConfigReader(config);

for (const scenarioBase of scenarios) {
const scenarioName = scenarioBase.name;
const scenario = configReader.scenarioConfig(scenarioName);
const {model, lighting, dimensions, exclude} = scenario;
const scenarioGoldensDirectory = path.join(goldensDirectory, scenarioName);
const {width, height} = dimensions;

Expand Down
Loading

0 comments on commit b28f16d

Please sign in to comment.