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

Revised pixelRatio in 3D plots to address multiple bugs #3573

Merged
merged 10 commits into from
Feb 26, 2019

Conversation

archmoj
Copy link
Contributor

@archmoj archmoj commented Feb 25, 2019

Supersedes #3571.

Codepen to test the fix for #3387.
Codepen to test the fix for #3572.
Codepen to test the fix for #3014.

@plotly/plotly_js

…tly.js side to work fine on iOS and FireFox

bug fix issue 3572 to preserve line widths in save 3d plots as image button as well as CI
removed an unused ortho argument from plot_api subroutine
improved ticks distances in orthographic views using latest gl-axes3d
package.json Outdated
"gl-pointcloud2d": "^1.0.2",
"gl-scatter3d": "^1.1.6",
"gl-scatter3d": "git://github.com/gl-vis/gl-scatter3d.git#6292ada845bdcd44a8e2db2d3c5e18c96c9ac210",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

package.json Outdated
"gl-plot2d": "^1.4.2",
"gl-plot3d": "^2.0.0",
"gl-plot3d": "git://github.com/gl-vis/gl-plot3d.git#3580a0eedd81b9f212186caa8e7018d8016274fe",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

image

nicely done here 🥇

package.json Outdated
"gl-contour2d": "^1.1.5",
"gl-error3d": "^1.0.13",
"gl-error3d": "git://github.com/gl-vis/gl-error3d.git#75ec29dd1dde51a697f718cdacf76e36a7bfd38c",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

package.json Outdated
"gl-streamtube3d": "^1.1.2",
"gl-surface3d": "^1.4.1",
"gl-streamtube3d": "git://github.com/gl-vis/gl-streamtube3d.git#ecdaa1dbbcd315ba06133aeccf870c98b993a8ae",
"gl-surface3d": "git://github.com/gl-vis/gl-surface3d.git#96e61eebac18e9b525f7f3e6b714291b5d1b4bad",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@etpinard
Copy link
Contributor

Wow. Fantastic PR @archmoj !

[x] generated a new set of gl3d baselines.

Are there any noticeable differences in the new baselines? Glancing at them quickly didn't reveal anything, but I'd like to double-check with you.

@@ -384,7 +384,7 @@ describe('Test gl3d plots', function() {
.then(done);
});

it('@gl should display correct hover labels (mesh3d case)', function(done) {
it('@noCI @gl should display correct hover labels (mesh3d case)', function(done) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this test still pass locally using

(plotly.js) $ ./tasks/noci_test.sh

?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately no. The mock is unexpectedly rotated after the click possibly related to uirevision.
But I need to figure that out.`

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes please,

(plotly.js) $ ./tasks/noci_test.sh

should (always 😄 ) pass.

@@ -340,7 +341,7 @@ function Scene(options, fullLayout) {
this.spikeOptions = createSpikeOptions(fullLayout[this.id]);
this.container = sceneContainer;
this.staticMode = !!options.staticPlot;
this.pixelRatio = options.plotGlPixelRatio || 2;
this.pixelRatio = this.pixelRatio || options.plotGlPixelRatio || 2;
Copy link
Contributor

Choose a reason for hiding this comment

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

This may break graphs where users set config option plotGlPixelRatio:

plotGlPixelRatio: {
valType: 'number',
dflt: 2,
min: 1,
max: 4,
description: [
'Set the pixel ratio during WebGL image export.',
'This config option was formerly named `plot3dPixelRatio`',
'which is now deprecated.'
].join(' ')
},

Orca does it here:

https://github.com/plotly/orca/blob/776d5c3f1faf7272f7eb6e1c11ba8d7fb0057734/src/component/plotly-graph/render.js#L30

using (a strange) value:

https://github.com/plotly/orca/blob/776d5c3f1faf7272f7eb6e1c11ba8d7fb0057734/src/component/plotly-graph/constants.js#L35

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh wait nevermind, this.pixelRatio isn't set by default (correct?) so options.plotGlPixelRatio is honoured.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes I think so.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok great. Can you try generating the gl3d_* baseline using orca with a few different plotGlPixelRatio values?

You may want to modify:

test_image () {
$root/../orca/bin/orca.js graph \
$root/test/image/mocks/mapbox_* \
$root/test/image/mocks/gl3d_cone* \
--plotly $root/build/plotly.js \
--mapbox-access-token "pk.eyJ1IjoiZXRwaW5hcmQiLCJhIjoiY2luMHIzdHE0MGFxNXVubTRxczZ2YmUxaCJ9.hwWZful0U2CQxit4ItNsiQ" \
--output-dir $root/test/image/baselines/ \
--verbose || EXIT_STATE=$?
}

to get orca started easily and you might have to tweak the orca src files e.g. here:

https://github.com/plotly/orca/blob/776d5c3f1faf7272f7eb6e1c11ba8d7fb0057734/src/component/plotly-graph/constants.js#L35

or

https://github.com/plotly/orca/blob/776d5c3f1faf7272f7eb6e1c11ba8d7fb0057734/src/component/plotly-graph/render.js#L30

to pass the different plotGlPixelRatio values down to plotly.js

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@etpinard Thank you so much for the links. Using orca I was able to produce gl3d_* images from this branch and compared them against the master branch. I also tweaked the pixelRatio of orca module and the configuration has an impact.

@archmoj
Copy link
Contributor Author

archmoj commented Feb 25, 2019

Wow. Fantastic PR @archmoj !

[x] generated a new set of gl3d baselines.

Are there any noticeable differences in the new baselines? Glancing at them quickly didn't reveal anything, but I'd like to double-check with you.

Well the primary goal of this PR was to possibly improve rendering of 3-D plots on different browsers & OS. Although in the other PR #3571 I was able to improve the quality of CI images by doubling the pixelRatio when anti-alias is not set to true by the hardware; the CI images form this PR may not illustrate much differences namely for the axis-lines. Anyway if we were interested to also achieve better CI images one idea may be to pass a different flag or use higher pixelRatio in the CI config?

@etpinard
Copy link
Contributor

nyway if we were interested to also achieve better CI images one idea may be to pass a different flag or use higher pixelRatio in the CI config?

I don't think that's necessary, but we should make sure that users setting plotGlPixelRatio get more pixels. Perhaps we could add a jasmine test for that using e.g.

https://github.com/plotly/plotly.js/blob/master/test/jasmine/assets/read_pixel.js

@archmoj
Copy link
Contributor Author

archmoj commented Feb 26, 2019

Wow. Fantastic PR @archmoj !

[x] generated a new set of gl3d baselines.

Are there any noticeable differences in the new baselines? Glancing at them quickly didn't reveal anything, but I'd like to double-check with you.

Regarding your question changes are noticeable in the following examples i.e. mainly related to surface contour lines and error bars.
https://github.com/plotly/plotly.js/pull/3573/files?short_path=d205ea8#diff-d205ea8d76e3e1a099b79bd08640c05b

https://github.com/plotly/plotly.js/pull/3573/files?short_path=5ae25d0#diff-5ae25d025346966db02254e38ac31363

https://github.com/plotly/plotly.js/pull/3573/files?short_path=1a569b4#diff-9c01fba6d75f01f7dfd92c50b2382ce3

@etpinard
Copy link
Contributor

Going to slip this in 1.45.0.

This is the last PR for 1.45.0 I promise 😄

@etpinard etpinard added this to the v1.45.0 milestone Feb 26, 2019
@archmoj
Copy link
Contributor Author

archmoj commented Feb 26, 2019

Going to slip this in 1.45.0.

This is the last PR for 1.45.0 I promise
@etpinard thanks
The modified test are passed on the CI and locally.

@etpinard
Copy link
Contributor

💃 💃 💃

@archmoj archmoj merged commit 50da961 into master Feb 26, 2019
@etpinard etpinard deleted the fixup-pixelratio-3d branch February 26, 2019 21:25
@archmoj archmoj mentioned this pull request Mar 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants