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

Volume - new gl3d trace #3488

Merged
merged 48 commits into from
Apr 8, 2019
Merged

Volume - new gl3d trace #3488

merged 48 commits into from
Apr 8, 2019

Conversation

archmoj
Copy link
Contributor

@archmoj archmoj commented Jan 28, 2019

Supersedes #3479 initial prototype.
New trace type for volume data visualisation.
Here is an interactive demo
gl3d_volume_airflow
Note: now opacityscale attribute options could be applied to emphasize on maximum or minimum values as well as both extremes.

package.json Outdated
@@ -77,7 +77,7 @@
"gl-heatmap2d": "^1.0.5",
"gl-line3d": "^1.1.8",
"gl-mat4": "^1.2.0",
"gl-mesh3d": "^2.0.7",
"gl-mesh3d": "git://github.com/gl-vis/gl-mesh3d.git#a361fdeae2fcaeed52efe05906f212e4b7c7bafa",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jackparmer
Copy link
Contributor

Interesting view on isosurface vs volume plots by a lab at Lawrence Livermore:
image
https://wci.llnl.gov/simulation/computer-codes/visit/screenshots

lib/index.js Outdated Show resolved Hide resolved
var height = this.data._Ys.length;
var depth = this.data._Zs.length;

var i = findNearestOnAxis(x, this.data._Xs).id;
Copy link
Contributor

Choose a reason for hiding this comment

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

... and "nearest" here means nearest on the "top" slice, correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Correct.

Copy link
Contributor

Choose a reason for hiding this comment

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

... which I think is ok for the first iteration, but could be potentially improved in the future.

Copy link
Contributor Author

@archmoj archmoj Jan 28, 2019

Choose a reason for hiding this comment

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

When possible, would you mind hovering on gl3d_volume4d_airflow in your browser?

@jackparmer
Copy link
Contributor

@archmoj do you have any more screenshots of the state of the art of this trace type so far?

mockName === 'font-wishlist' ||
mockName.indexOf('gl3d_volume_') !== -1 ||
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm. That's less than ideal. Do you have an idea why we can't pixel-compare volume mocks?

Moreover, have you tried generating the volume baseline using orca?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think there is one mock that caused a problem. Now with @antoinerg parallel PR in place I could fix this.
Second question: No I have not tried volume with orca.

Copy link
Contributor

Choose a reason for hiding this comment

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

Second question: No I have not tried volume with orca.

Cool, could you give it a try?

Copy link
Contributor

Choose a reason for hiding this comment

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

See

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

for a sample orca command.

}
};

function isValidScaleArray(scl) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Very nicely done 🥇

@etpinard
Copy link
Contributor

etpinard commented Apr 2, 2019

Looks like adding those volume tests to npm run test-image makes our CI run slower by about 1 minute:

image

but oh well, I'm ok with this 👌 . We should try to keep to number of volume down to a minimum though.

@etpinard
Copy link
Contributor

etpinard commented Apr 2, 2019

@archmoj could you tell us a little bit more about how your volume renderer compare to MATLAB's https://www.mathworks.com/help/matlab/volume-visualization.html ? Thanks!

@archmoj
Copy link
Contributor Author

archmoj commented Apr 2, 2019

Looks like adding those volume tests to npm run test-image makes our CI run slower by about 1 minute:

image

but oh well, I'm ok with this . We should try to keep to number of volume down to a minimum though.

Good observation.

@archmoj
Copy link
Contributor Author

archmoj commented Apr 3, 2019

Looks like adding those volume tests to npm run test-image makes our CI run slower by about 1 minute:

That was basically the result of increasing the waiting time between the batches.
Now reset to normal in 0aa25f0.

var Registry = require('../../registry');
var colorscaleDefaults = require('../../components/colorscale/defaults');

module.exports = function supplyIsoDefaults(traceIn, traceOut, defaultColor, layout, coerce) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nicely done! But I would prefer having this supplyIsoDefaults in isosurface/defaults.js.

We're trying to move away form this pattern where each defaults-related functions would get their own files. We now prefer having just one defaults.js file per trace module and have its reusable pieces exported along with the main trace supplyDefaults. function. See box/defaults.js for an example.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in af17adc.

@etpinard
Copy link
Contributor

etpinard commented Apr 3, 2019

@archmoj can you add volume and isosurface to the gl3d partial bundle list: https://github.com/plotly/plotly.js/blob/master/lib/index-gl3d.js

@archmoj
Copy link
Contributor Author

archmoj commented Apr 3, 2019

@archmoj can you add volume and isosurface to the gl3d partial bundle list: https://github.com/plotly/plotly.js/blob/master/lib/index-gl3d.js

Yes. Thanks for the link.
Done in 130da2f.

@etpinard
Copy link
Contributor

etpinard commented Apr 4, 2019

This PR is looking good!

@archmoj two things:

Thanks very much!

@archmoj
Copy link
Contributor Author

archmoj commented Apr 4, 2019

Thanks for the link. From that link I also found this interesting link:
https://www.mathworks.com/help/matlab/visualize/overview-of-volume-visualization.html

It looks that the way matlab does this require multiple steps to create the patch. Since our isosurface was capable of generating two or multiple surfaces between iso-values, and at the same time drawing iso-caps and slices those features are accessible to the user in volume trace too.
Thinking of visualisation of wind data in 3D (x, y, z, u, v, w), one could generate an example to display opaque slices, caps from isosurface and use volume on wind speed {value = (u*u + v*v + z*z)^0.5}, then add cone or streamtube plots to draw 3D wind direction vectors (u, v, w).
Some other 'nice-to-have' features (for future work) could be adding attributes to isosurface & volume for clipping/reducing volume data similar to https://www.mathworks.com/help/matlab/ref/subvolume.html and drawing contour-slices on the plot https://www.mathworks.com/help/matlab/ref/contourslice.html.

@etpinard
Copy link
Contributor

etpinard commented Apr 5, 2019

@archmoj the gl3d_volume mocks can't render in time (i.e. before the timeout) on my machine, making npm run test-image fail 😡

Do we have to test such large mocks in order to 🔒 down the behaviour?

@archmoj
Copy link
Contributor Author

archmoj commented Apr 5, 2019

@archmoj the gl3d_volume mocks can't render in time (i.e. before the timeout) on my machine, making npm run test-image fail

Do we have to test such large mocks in order to down the behaviour?

Should we rename the mocks?
@etpinard if you are still on the branch could you please check the orca export?

@etpinard
Copy link
Contributor

etpinard commented Apr 5, 2019

Should we rename the mocks?

No, I think we should reduce the size of their data arrays.

@etpinard
Copy link
Contributor

etpinard commented Apr 5, 2019

if you are still on the branch could you please check the orca export?

Are you having issues running orca?

@archmoj
Copy link
Contributor Author

archmoj commented Apr 5, 2019

if you are still on the branch could you please check the orca export?

Are you having issues running orca?

Yes - I needed to reinstall it. But then it didn't work : (

@archmoj
Copy link
Contributor Author

archmoj commented Apr 5, 2019

Should we rename the mocks?

No, I think we should reduce the size of their data arrays.

OK. I will take care of that.

@archmoj
Copy link
Contributor Author

archmoj commented Apr 5, 2019

@etpinard I was able to test orca export.
When possible please retry running the test-image with the reduced volume mocks on your machine.
Thank you very much in advance.

@etpinard
Copy link
Contributor

etpinard commented Apr 8, 2019

@archmoj commit e23b2c3 is brilliant. Thanks very much for doing this.

I can confirm that the image tests are passing smoothly on my machine and orca exports are looking crisp!

Let's get this in 💃 💃 💃

@archmoj archmoj merged commit e5b8c71 into master Apr 8, 2019
@archmoj archmoj deleted the volume4d branch April 8, 2019 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants