diff --git a/package-lock.json b/package-lock.json
index f4f8b9059ea..035f872de91 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -5103,9 +5103,9 @@
}
},
"gl-surface3d": {
- "version": "1.4.6",
- "resolved": "https://registry.npmjs.org/gl-surface3d/-/gl-surface3d-1.4.6.tgz",
- "integrity": "sha512-aItWQTNUX3JJc6i2FbXX82ljPZgDV3kXzkzANcBGoAnKwRpJw12WcMKKTL4sOCs9BW+3sx6BhR0P5+2zh5Scfw==",
+ "version": "1.5.0",
+ "resolved": "https://registry.npmjs.org/gl-surface3d/-/gl-surface3d-1.5.0.tgz",
+ "integrity": "sha512-0FZQKUlviZ+bJYg0MPxiIh800Li+Jn08oKze6ipEXo1rcFff7f0sqwU5tht9h3Y/uMU9lYEwYfvIFZgzXMo1Kg==",
"requires": {
"binary-search-bounds": "^2.0.4",
"bit-twiddle": "^1.0.2",
diff --git a/package.json b/package.json
index 591f1629a43..03c4477e823 100644
--- a/package.json
+++ b/package.json
@@ -88,7 +88,7 @@
"gl-select-box": "^1.0.3",
"gl-spikes2d": "^1.0.2",
"gl-streamtube3d": "^1.4.0",
- "gl-surface3d": "^1.4.6",
+ "gl-surface3d": "^1.5.0",
"gl-text": "^1.1.8",
"glslify": "^7.0.0",
"has-hover": "^1.0.1",
diff --git a/src/traces/surface/attributes.js b/src/traces/surface/attributes.js
index cf64b94aafa..caf47644a72 100644
--- a/src/traces/surface/attributes.js
+++ b/src/traces/surface/attributes.js
@@ -298,6 +298,24 @@ colorScaleAttrs('', {
].join(' ')
},
+ opacityscale: {
+ valType: 'any',
+ role: 'style',
+ editType: 'calc',
+ description: [
+ 'Sets the opacityscale.',
+ ' The opacityscale must be an array containing',
+ ' arrays mapping a normalized value to an opacity value.',
+ ' At minimum, a mapping for the lowest (0) and highest (1)',
+ ' values are required. For example,',
+ ' `[[0, 1], [0.5, 0.2], [1, 1]]` means that higher/lower values would have',
+ ' higher opacity values and those in the middle would be more transparent',
+ ' Alternatively, `opacityscale` may be a palette name string',
+ ' of the following list: \'min\', \'max\', \'extremes\' and \'uniform\'.',
+ ' The default is \'uniform\'.'
+ ].join('')
+ },
+
_deprecated: {
zauto: extendFlat({}, colorScaleAttrs.zauto, {
description: 'Obsolete. Use `cauto` instead.'
diff --git a/src/traces/surface/convert.js b/src/traces/surface/convert.js
index 1b54c6cb165..e79e2266a98 100644
--- a/src/traces/surface/convert.js
+++ b/src/traces/surface/convert.js
@@ -532,6 +532,7 @@ proto.update = function(data) {
dynamicColor: [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]],
dynamicWidth: [1, 1, 1],
dynamicTint: [1, 1, 1],
+ opacityscale: data.opacityscale,
opacity: data.opacity
};
diff --git a/src/traces/surface/defaults.js b/src/traces/surface/defaults.js
index d70f18e5cf9..9c35bd283fc 100644
--- a/src/traces/surface/defaults.js
+++ b/src/traces/surface/defaults.js
@@ -14,7 +14,45 @@ var Lib = require('../../lib');
var colorscaleDefaults = require('../../components/colorscale/defaults');
var attributes = require('./attributes');
-module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) {
+var MIN = 0.1; // Note: often we don't want the data cube to be disappeared
+
+function createWave(n, minOpacity) {
+ var arr = [];
+ var steps = 32; // Max: 256
+ for(var i = 0; i < steps; i++) {
+ var u = i / (steps - 1);
+ var v = minOpacity + (1 - minOpacity) * (1 - Math.pow(Math.sin(n * u * Math.PI), 2));
+ arr.push([
+ u,
+ Math.max(1, Math.min(0, v))
+ ]);
+ }
+ return arr;
+}
+
+function isValidScaleArray(scl) {
+ var highestVal = 0;
+
+ if(!Array.isArray(scl) || scl.length < 2) return false;
+
+ if(!scl[0] || !scl[scl.length - 1]) return false;
+
+ if(+scl[0][0] !== 0 || +scl[scl.length - 1][0] !== 1) return false;
+
+ for(var i = 0; i < scl.length; i++) {
+ var si = scl[i];
+
+ if(si.length !== 2 || +si[0] < highestVal) {
+ return false;
+ }
+
+ highestVal = +si[0];
+ }
+
+ return true;
+}
+
+function supplyDefaults(traceIn, traceOut, defaultColor, layout) {
var i, j;
function coerce(attr, dflt) {
@@ -102,13 +140,33 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
traceIn, traceOut, layout, coerce, {prefix: '', cLetter: 'c'}
);
+ opacityscaleDefaults(traceIn, traceOut, layout, coerce);
+
// disable 1D transforms - currently surface does NOT support column data like heatmap does
// you can use mesh3d for this use case, but not surface
traceOut._length = null;
-};
+}
+
+function opacityscaleDefaults(traceIn, traceOut, layout, coerce) {
+ var opacityscale = coerce('opacityscale');
+ if(opacityscale === 'max') {
+ traceOut.opacityscale = [[0, MIN], [1, 1]];
+ } else if(opacityscale === 'min') {
+ traceOut.opacityscale = [[0, 1], [1, MIN]];
+ } else if(opacityscale === 'extremes') {
+ traceOut.opacityscale = createWave(1, MIN);
+ } else if(!isValidScaleArray(opacityscale)) {
+ traceOut.opacityscale = undefined;
+ }
+}
function mapLegacy(traceIn, oldAttr, newAttr) {
if(oldAttr in traceIn && !(newAttr in traceIn)) {
traceIn[newAttr] = traceIn[oldAttr];
}
}
+
+module.exports = {
+ supplyDefaults: supplyDefaults,
+ opacityscaleDefaults: opacityscaleDefaults
+};
diff --git a/src/traces/surface/index.js b/src/traces/surface/index.js
index bbc5d622970..b01d03b717f 100644
--- a/src/traces/surface/index.js
+++ b/src/traces/surface/index.js
@@ -10,7 +10,7 @@
module.exports = {
attributes: require('./attributes'),
- supplyDefaults: require('./defaults'),
+ supplyDefaults: require('./defaults').supplyDefaults,
colorbar: {
min: 'cmin',
max: 'cmax'
diff --git a/src/traces/volume/attributes.js b/src/traces/volume/attributes.js
index df20c953a8f..5f3602d160d 100644
--- a/src/traces/volume/attributes.js
+++ b/src/traces/volume/attributes.js
@@ -10,6 +10,7 @@
var colorScaleAttrs = require('../../components/colorscale/attributes');
var isosurfaceAttrs = require('../isosurface/attributes');
+var surfaceAttrs = require('../surface/attributes');
var baseAttrs = require('../../plots/attributes');
var extendFlat = require('../../lib/extend').extendFlat;
@@ -63,23 +64,7 @@ colorScaleAttrs('', {
colorbar: isosurfaceAttrs.colorbar,
opacity: isosurfaceAttrs.opacity,
- opacityscale: {
- valType: 'any',
- role: 'style',
- editType: 'calc',
- description: [
- 'Sets the opacityscale.',
- ' The opacityscale must be an array containing',
- ' arrays mapping a normalized value to an opacity value.',
- ' At minimum, a mapping for the lowest (0) and highest (1)',
- ' values are required. For example,',
- ' `[[0, 1], [0.5, 0.2], [1, 1]]` means that higher/lower values would have',
- ' higher opacity values and those in the middle would be more transparent',
- ' Alternatively, `opacityscale` may be a palette name string',
- ' of the following list: \'min\', \'max\', \'extremes\' and \'uniform\'.',
- ' The default is \'uniform\'.'
- ].join('')
- },
+ opacityscale: surfaceAttrs.opacityscale,
lightposition: isosurfaceAttrs.lightposition,
lighting: isosurfaceAttrs.lighting,
diff --git a/src/traces/volume/defaults.js b/src/traces/volume/defaults.js
index 77d1616e9cc..f6f86395509 100644
--- a/src/traces/volume/defaults.js
+++ b/src/traces/volume/defaults.js
@@ -11,22 +11,7 @@
var Lib = require('../../lib');
var attributes = require('./attributes');
var supplyIsoDefaults = require('../isosurface/defaults').supplyIsoDefaults;
-
-var MIN = 0.1; // Note: often we don't want the data cube to be disappeared
-
-function createWave(n, minOpacity) {
- var arr = [];
- var steps = 32; // Max: 256
- for(var i = 0; i < steps; i++) {
- var u = i / (steps - 1);
- var v = minOpacity + (1 - minOpacity) * (1 - Math.pow(Math.sin(n * u * Math.PI), 2));
- arr.push([
- u,
- Math.max(1, Math.min(0, v))
- ]);
- }
- return arr;
-}
+var opacityscaleDefaults = require('../surface/defaults').opacityscaleDefaults;
module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) {
function coerce(attr, dflt) {
@@ -35,36 +20,5 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
supplyIsoDefaults(traceIn, traceOut, defaultColor, layout, coerce);
- var opacityscale = coerce('opacityscale');
- if(opacityscale === 'max') {
- traceOut.opacityscale = [[0, MIN], [1, 1]];
- } else if(opacityscale === 'min') {
- traceOut.opacityscale = [[0, 1], [1, MIN]];
- } else if(opacityscale === 'extremes') {
- traceOut.opacityscale = createWave(1, MIN);
- } else if(!isValidScaleArray(opacityscale)) {
- traceOut.opacityscale = undefined;
- }
+ opacityscaleDefaults(traceIn, traceOut, layout, coerce);
};
-
-function isValidScaleArray(scl) {
- var highestVal = 0;
-
- if(!Array.isArray(scl) || scl.length < 2) return false;
-
- if(!scl[0] || !scl[scl.length - 1]) return false;
-
- if(+scl[0][0] !== 0 || +scl[scl.length - 1][0] !== 1) return false;
-
- for(var i = 0; i < scl.length; i++) {
- var si = scl[i];
-
- if(si.length !== 2 || +si[0] < highestVal) {
- return false;
- }
-
- highestVal = +si[0];
- }
-
- return true;
-}
diff --git a/test/image/baselines/gl3d_opacity-surface.png b/test/image/baselines/gl3d_opacity-surface.png
index c5f10f521ac..da485ff60a6 100644
Binary files a/test/image/baselines/gl3d_opacity-surface.png and b/test/image/baselines/gl3d_opacity-surface.png differ
diff --git a/test/image/baselines/gl3d_surface-circular-opacityscale.png b/test/image/baselines/gl3d_surface-circular-opacityscale.png
new file mode 100644
index 00000000000..519e2b2d5ba
Binary files /dev/null and b/test/image/baselines/gl3d_surface-circular-opacityscale.png differ
diff --git a/test/image/baselines/gl3d_surface_opacity-and-opacityscale.png b/test/image/baselines/gl3d_surface_opacity-and-opacityscale.png
new file mode 100644
index 00000000000..44ec31db7d3
Binary files /dev/null and b/test/image/baselines/gl3d_surface_opacity-and-opacityscale.png differ
diff --git a/test/image/baselines/gl3d_surface_opacity_match_mesh3d.png b/test/image/baselines/gl3d_surface_opacity_match_mesh3d.png
new file mode 100644
index 00000000000..d1accd86855
Binary files /dev/null and b/test/image/baselines/gl3d_surface_opacity_match_mesh3d.png differ
diff --git a/test/image/baselines/gl3d_surface_opacityscale_contour.png b/test/image/baselines/gl3d_surface_opacityscale_contour.png
new file mode 100644
index 00000000000..cc01ef66b59
Binary files /dev/null and b/test/image/baselines/gl3d_surface_opacityscale_contour.png differ
diff --git a/test/image/baselines/gl3d_traces-with-opacity.png b/test/image/baselines/gl3d_traces-with-opacity.png
index 7c0deb95ffe..1cbd90a9224 100644
Binary files a/test/image/baselines/gl3d_traces-with-opacity.png and b/test/image/baselines/gl3d_traces-with-opacity.png differ
diff --git a/test/image/mocks/gl3d_surface-circular-opacityscale.json b/test/image/mocks/gl3d_surface-circular-opacityscale.json
new file mode 100644
index 00000000000..f106636edae
--- /dev/null
+++ b/test/image/mocks/gl3d_surface-circular-opacityscale.json
@@ -0,0 +1,1016 @@
+{
+ "data": [
+ {
+ "type": "surface",
+ "x": [
+ -2,
+ -1.8,
+ -1.6,
+ -1.4,
+ -1.2,
+ -1,
+ -0.7999999999999998,
+ -0.5999999999999999,
+ -0.3999999999999999,
+ -0.19999999999999996,
+ 0,
+ 0.20000000000000018,
+ 0.40000000000000036,
+ 0.6000000000000001,
+ 0.8000000000000003,
+ 1,
+ 1.2000000000000002,
+ 1.4000000000000004,
+ 1.6,
+ 1.8000000000000003
+ ],
+ "y": [
+ -2,
+ -1.8,
+ -1.6,
+ -1.4,
+ -1.2,
+ -1,
+ -0.7999999999999998,
+ -0.5999999999999999,
+ -0.3999999999999999,
+ -0.19999999999999996,
+ 0,
+ 0.20000000000000018,
+ 0.40000000000000036,
+ 0.6000000000000001,
+ 0.8000000000000003,
+ 1,
+ 1.2000000000000002,
+ 1.4000000000000004,
+ 1.6,
+ 1.8000000000000003
+ ],
+ "z": [
+ [
+ 0.12106212095217864,
+ 0.13391619644453984,
+ 0.1484264475026643,
+ 0.16480276985005352,
+ 0.1831831215050568,
+ 0.20346525427851744,
+ 0.22502859102187622,
+ 0.24641579841371794,
+ 0.2651904367146476,
+ 0.27828918745648695,
+ 0.2830188679245283,
+ 0.27828918745648695,
+ 0.2651904367146476,
+ 0.24641579841371788,
+ 0.22502859102187617,
+ 0.20346525427851744,
+ 0.1831831215050568,
+ 0.16480276985005346,
+ 0.1484264475026643,
+ 0.13391619644453984
+ ],
+ [
+ 0.13235443087474313,
+ 0.14765829425106372,
+ 0.1653012784279493,
+ 0.1858069434727604,
+ 0.2097759777706337,
+ 0.23765893520734632,
+ 0.2692167448993003,
+ 0.3026743835410207,
+ 0.3339556900502005,
+ 0.35690659649566253,
+ 0.3654320142407229,
+ 0.35690659649566253,
+ 0.3339556900502004,
+ 0.3026743835410207,
+ 0.26921674489930025,
+ 0.23765893520734632,
+ 0.20977597777063361,
+ 0.18580694347276028,
+ 0.1653012784279493,
+ 0.14765829425106372
+ ],
+ [
+ 0.14427731461154852,
+ 0.16225464147058594,
+ 0.1833409695431943,
+ 0.20852940520843458,
+ 0.2392919331557277,
+ 0.27744386917531194,
+ 0.32429368995050867,
+ 0.3786891160601657,
+ 0.4343193264008968,
+ 0.4783407780091745,
+ 0.49544224247892216,
+ 0.4783407780091744,
+ 0.43431932640089665,
+ 0.3786891160601657,
+ 0.3242936899505087,
+ 0.27744386917531194,
+ 0.23929193315572772,
+ 0.20852940520843452,
+ 0.1833409695431943,
+ 0.16225464147058588
+ ],
+ [
+ 0.1567051295223317,
+ 0.1774734471381117,
+ 0.2020454230681136,
+ 0.2319415687988375,
+ 0.26999413496034014,
+ 0.32089181723183297,
+ 0.3904551967208083,
+ 0.4818983496393171,
+ 0.5882772456596558,
+ 0.6831576508301488,
+ 0.7230255839822025,
+ 0.6831576508301486,
+ 0.5882772456596556,
+ 0.4818983496393171,
+ 0.3904551967208081,
+ 0.32089181723183297,
+ 0.26999413496034014,
+ 0.23194156879883743,
+ 0.2020454230681136,
+ 0.17747344713811164
+ ],
+ [
+ 0.16956420362849825,
+ 0.1931670642084396,
+ 0.22091489425423821,
+ 0.25450400972522896,
+ 0.2981952512323712,
+ 0.3617413678987852,
+ 0.46216836773533665,
+ 0.6185062602395801,
+ 0.8365222151986836,
+ 1.074480765781358,
+ 1.1921409593063907,
+ 1.0744807657813575,
+ 0.8365222151986831,
+ 0.6185062602395798,
+ 0.46216836773533615,
+ 0.3617413678987852,
+ 0.2981952512323712,
+ 0.25450400972522885,
+ 0.22091489425423821,
+ 0.1931670642084396
+ ],
+ [
+ 0.1829074748932239,
+ 0.20951541142188626,
+ 0.24002850466248696,
+ 0.27504577210350845,
+ 0.31825470333718864,
+ 0.3855289616378948,
+ 0.5192471794543464,
+ 0.7829746104592944,
+ 1.243389906907365,
+ 1.9578802455065187,
+ 2.4999999999999996,
+ 1.9578802455065176,
+ 1.243389906907364,
+ 0.7829746104592943,
+ 0.5192471794543458,
+ 0.3855289616378948,
+ 0.31825470333718864,
+ 0.2750457721035084,
+ 0.24002850466248696,
+ 0.20951541142188626
+ ],
+ [
+ 0.19691909621957804,
+ 0.22725237382292102,
+ 0.2610564975231564,
+ 0.2956641503379131,
+ 0.32688127476520806,
+ 0.3657675079097114,
+ 0.5121238443591127,
+ 0.9490629992056218,
+ 1.8380365552345206,
+ 4.007035082500299,
+ 7,
+ 4.0070350825002965,
+ 1.8380365552345177,
+ 0.9490629992056211,
+ 0.5121238443591121,
+ 0.3657675079097114,
+ 0.32688127476520806,
+ 0.2956641503379131,
+ 0.2610564975231564,
+ 0.227252373822921
+ ],
+ [
+ 0.21171175226050434,
+ 0.24744673499839998,
+ 0.2877783390268835,
+ 0.32669728005862775,
+ 0.34318729591367064,
+ 0.28342136289614944,
+ 0.34581586887220295,
+ 1.1928315203392124,
+ 2.540313670282644,
+ 5.110037626948135,
+ 7,
+ 5.110037626948129,
+ 2.54031367028264,
+ 1.1928315203392115,
+ 0.3458158688722018,
+ 0.28342136289614944,
+ 0.3431872959136706,
+ 0.3266972800586277,
+ 0.2877783390268835,
+ 0.24744673499839995
+ ],
+ [
+ 0.22686916188190073,
+ 0.27034258405274836,
+ 0.32353282175039527,
+ 0.38437082812859386,
+ 0.43762969300447896,
+ 0.4259569687488884,
+ 0.7215722091793167,
+ 2.5463002673502926,
+ 3.6059116172396815,
+ 4.79760327321245,
+ 5.6070826306914,
+ 4.797603273212448,
+ 3.605911617239679,
+ 2.5463002673502912,
+ 0.7215722091793136,
+ 0.4259569687488884,
+ 0.437629693004479,
+ 0.3843708281285937,
+ 0.32353282175039527,
+ 0.27034258405274825
+ ],
+ [
+ 0.24101641921830794,
+ 0.29378137639565316,
+ 0.3652831621758866,
+ 0.466926508799923,
+ 0.6308192248594284,
+ 1.0290313920139607,
+ 3.6635341121697045,
+ 7,
+ 4.870588027869557,
+ 4.889259607768155,
+ 5.0480769230769225,
+ 4.889259607768155,
+ 4.87058802786956,
+ 7,
+ 3.6635341121696845,
+ 1.0290313920139607,
+ 0.6308192248594282,
+ 0.4669265087999227,
+ 0.3652831621758866,
+ 0.2937813763956531
+ ],
+ [
+ 0.25194063396687544,
+ 0.3131287886851263,
+ 0.40202492355550695,
+ 0.5426532983720722,
+ 0.7997665528320698,
+ 1.3867504905630728,
+ 2.926467794921943,
+ 4.767636287390837,
+ 5.0036754107256955,
+ 5.000153597247573,
+ 4.999999999999999,
+ 5.000153597247573,
+ 5.0036754107256955,
+ 4.767636287390835,
+ 2.926467794921938,
+ 1.3867504905630728,
+ 0.7997665528320695,
+ 0.542653298372072,
+ 0.40202492355550695,
+ 0.31312878868512617
+ ],
+ [
+ 0.2573989427483484,
+ 0.32348725277112533,
+ 0.42213443947430856,
+ 0.5815893898805242,
+ 0.8667944515259005,
+ 1.427059417004871,
+ 2.5066340311389044,
+ 4.039763543182584,
+ 5.097366581619938,
+ 5.113249284859651,
+ 4.952076677316293,
+ 5.113249284859651,
+ 5.097366581619937,
+ 4.039763543182582,
+ 2.5066340311389013,
+ 1.427059417004871,
+ 0.8667944515259002,
+ 0.5815893898805238,
+ 0.42213443947430856,
+ 0.32348725277112506
+ ],
+ [
+ 0.2560628254037621,
+ 0.3221794956906776,
+ 0.4204627501697274,
+ 0.5765463634128469,
+ 0.8442064717999366,
+ 1.3407683199248421,
+ 2.3348804821262945,
+ 4.476766265084763,
+ 6.912502148164137,
+ 5.246625183131949,
+ 4.452054794520547,
+ 5.246625183131951,
+ 6.912502148164138,
+ 4.476766265084759,
+ 2.334880482126292,
+ 1.3407683199248421,
+ 0.8442064717999361,
+ 0.5765463634128466,
+ 0.4204627501697274,
+ 0.3221794956906775
+ ],
+ [
+ 0.24796766547552965,
+ 0.30955771863062365,
+ 0.39885222475156584,
+ 0.53524753775174,
+ 0.7570698920621682,
+ 1.149313561515385,
+ 1.9583000658921055,
+ 4.528902113412604,
+ 7,
+ 3.9916140741827957,
+ 2.822580645161289,
+ 3.9916140741827997,
+ 7,
+ 4.5289021134126,
+ 1.9583000658921028,
+ 1.149313561515385,
+ 0.7570698920621679,
+ 0.5352475377517396,
+ 0.39885222475156584,
+ 0.30955771863062354
+ ],
+ [
+ 0.23433906517591221,
+ 0.28828445033004263,
+ 0.36342098584893323,
+ 0.4717988000926221,
+ 0.6344126751393393,
+ 0.8904402293142654,
+ 1.3202739031176003,
+ 2.053633040346806,
+ 2.433851714551933,
+ 1.4264198394050538,
+ 0.9248029108550615,
+ 1.4264198394050547,
+ 2.4338517145519343,
+ 2.0536330403468046,
+ 1.320273903117599,
+ 0.8904402293142654,
+ 0.6344126751393392,
+ 0.47179880009262204,
+ 0.36342098584893323,
+ 0.2882844503300425
+ ],
+ [
+ 0.21705333996212414,
+ 0.26202412075485043,
+ 0.3215888122642306,
+ 0.4016056086973147,
+ 0.5097315856891722,
+ 0.6535056581267521,
+ 0.8285261222597814,
+ 0.9693218249925671,
+ 0.8827969941629255,
+ 0.4932205618325584,
+ 0,
+ 0.4932205618325589,
+ 0.882796994162926,
+ 0.9693218249925671,
+ 0.828526122259781,
+ 0.6535056581267521,
+ 0.5097315856891721,
+ 0.40160560869731454,
+ 0.3215888122642306,
+ 0.2620241207548504
+ ],
+ [
+ 0.19804939639716945,
+ 0.23422258856705055,
+ 0.2795936632376179,
+ 0.33612177086515815,
+ 0.4046639335177137,
+ 0.48181965581063224,
+ 0.5525158469680114,
+ 0.5797885391640621,
+ 0.5162348978262852,
+ 0.36953185531884536,
+ 0.2708010951077253,
+ 0.3695318553188456,
+ 0.5162348978262854,
+ 0.5797885391640621,
+ 0.552515846968011,
+ 0.48181965581063224,
+ 0.4046639335177136,
+ 0.3361217708651579,
+ 0.2795936632376179,
+ 0.23422258856705058
+ ],
+ [
+ 0.1789131090663803,
+ 0.20737666952447564,
+ 0.24124455043023296,
+ 0.28061385716818427,
+ 0.324122206678205,
+ 0.36729256898218693,
+ 0.40047346321991045,
+ 0.40925585163311834,
+ 0.383845342758816,
+ 0.3376271074538803,
+ 0.31264341441027993,
+ 0.3376271074538803,
+ 0.3838453427588161,
+ 0.40925585163311823,
+ 0.4004734632199104,
+ 0.36729256898218693,
+ 0.324122206678205,
+ 0.2806138571681842,
+ 0.24124455043023296,
+ 0.20737666952447564
+ ],
+ [
+ 0.16071101420949183,
+ 0.18288632489196696,
+ 0.20807150483235562,
+ 0.23572625283744453,
+ 0.2642808628859394,
+ 0.2905803794877529,
+ 0.3097510667016822,
+ 0.31666020308420467,
+ 0.30996938980036315,
+ 0.2966065073740306,
+ 0.2897313808283173,
+ 0.29660650737403055,
+ 0.3099693898003631,
+ 0.3166602030842047,
+ 0.30975106670168234,
+ 0.2905803794877529,
+ 0.26428086288593944,
+ 0.23572625283744444,
+ 0.20807150483235562,
+ 0.18288632489196688
+ ],
+ [
+ 0.1440224104511189,
+ 0.16128540683597092,
+ 0.18015326583684085,
+ 0.20000144339537007,
+ 0.2196187350319719,
+ 0.23711110159590834,
+ 0.2501514443951206,
+ 0.2568863526410077,
+ 0.2574111709190629,
+ 0.25467414047994746,
+ 0.25304152562254917,
+ 0.25467414047994746,
+ 0.2574111709190629,
+ 0.25688635264100773,
+ 0.2501514443951206,
+ 0.23711110159590834,
+ 0.2196187350319719,
+ 0.20000144339537004,
+ 0.18015326583684085,
+ 0.1612854068359709
+ ]
+ ],
+ "surfacecolor": [
+ [
+ -1.602262569263822,
+ -1.507737694088095,
+ -1.4039455871508713,
+ -1.289144991843712,
+ -1.160932263804583,
+ -1.0163113952957221,
+ -0.8521998573752884,
+ -0.6664785543181517,
+ -0.45938767034817135,
+ -0.23471174480071988,
+ 0,
+ 0.23471174480072016,
+ 0.45938767034817196,
+ 0.6664785543181518,
+ 0.8521998573752887,
+ 1.0163113952957221,
+ 1.160932263804583,
+ 1.2891449918437121,
+ 1.4039455871508713,
+ 1.5077376940880953
+ ],
+ [
+ -1.7061755521230937,
+ -1.6142319273951078,
+ -1.5132682996645985,
+ -1.4013568861480483,
+ -1.275334601585075,
+ -1.1305277242541982,
+ -0.9612160656999492,
+ -0.7622832154582723,
+ -0.5318685843442486,
+ -0.2740514108321243,
+ 0,
+ 0.27405141083212453,
+ 0.5318685843442492,
+ 0.7622832154582725,
+ 0.9612160656999494,
+ 1.1305277242541982,
+ 1.2753346015850753,
+ 1.4013568861480485,
+ 1.5132682996645985,
+ 1.6142319273951078
+ ],
+ [
+ -1.8178839293615092,
+ -1.7296229210813845,
+ -1.633329095168591,
+ -1.5274072062636646,
+ -1.4083104935238229,
+ -1.2693172741935068,
+ -1.100392545381768,
+ -0.8905999780667393,
+ -0.6330298809921485,
+ -0.33057520376949195,
+ 0,
+ 0.33057520376949234,
+ 0.6330298809921492,
+ 0.8905999780667395,
+ 1.1003925453817684,
+ 1.2693172741935068,
+ 1.408310493523823,
+ 1.5274072062636648,
+ 1.633329095168591,
+ 1.7296229210813847
+ ],
+ [
+ -1.93686385654253,
+ -1.8529173882399725,
+ -1.7627020185716444,
+ -1.6660763485383288,
+ -1.560550216242889,
+ -1.4378071773233658,
+ -1.281086519417455,
+ -1.0683576606154572,
+ -0.7815671182389958,
+ -0.41744952135818925,
+ 0,
+ 0.41744952135818947,
+ 0.7815671182389965,
+ 1.0683576606154577,
+ 1.2810865194174554,
+ 1.4378071773233658,
+ 1.560550216242889,
+ 1.666076348538329,
+ 1.7627020185716444,
+ 1.8529173882399723
+ ],
+ [
+ -2.0624432751981585,
+ -1.9824463062953803,
+ -1.8981504116269774,
+ -1.812675679004511,
+ -1.7284111350248457,
+ -1.6391741655377285,
+ -1.518476986630911,
+ -1.3225492530062357,
+ -1.0120436342788945,
+ -0.5639129982137923,
+ 0,
+ 0.5639129982137926,
+ 1.0120436342788954,
+ 1.3225492530062357,
+ 1.5184769866309114,
+ 1.6391741655377285,
+ 1.7284111350248461,
+ 1.812675679004511,
+ 1.8981504116269774,
+ 1.9824463062953803
+ ],
+ [
+ -2.1943169820062036,
+ -2.1165421343513575,
+ -2.0348240494182206,
+ -1.9568747796626658,
+ -1.897443211406515,
+ -1.8681614720188202,
+ -1.832613950728721,
+ -1.6938708391656425,
+ -1.384939895235137,
+ -0.8484439222121094,
+ 0,
+ 0.8484439222121101,
+ 1.384939895235138,
+ 1.6938708391656427,
+ 1.8326139507287211,
+ 1.8681614720188202,
+ 1.8974432114065152,
+ 1.956874779662666,
+ 2.0348240494182206,
+ 2.1165421343513575
+ ],
+ [
+ -2.3333913580298833,
+ -2.2553502511546646,
+ -2.1690978349661805,
+ -2.083284900044504,
+ -2.0288348961796183,
+ -2.0860736061337892,
+ -2.2619938636764028,
+ -2.23960848473103,
+ -1.9644614649350434,
+ -1.5058984151193622,
+ 0,
+ 1.505898415119363,
+ 1.964461464935044,
+ 2.23960848473103,
+ 2.2619938636764023,
+ 2.0860736061337892,
+ 2.0288348961796183,
+ 2.083284900044504,
+ 2.1690978349661805,
+ 2.255350251154665
+ ],
+ [
+ -2.482458454767041,
+ -2.4033254383711573,
+ -2.305999342376989,
+ -2.1874011242236797,
+ -2.057585765018552,
+ -2.059294981262936,
+ -3.0515589403836034,
+ -3.038114299104269,
+ -2.6645558539640657,
+ -2.501236188518951,
+ 3.141592653589793,
+ 2.501236188518951,
+ 2.664555853964066,
+ 3.0381142991042696,
+ 3.051558940383601,
+ 2.059294981262936,
+ 2.0575857650185525,
+ 2.1874011242236797,
+ 2.305999342376989,
+ 2.4033254383711573
+ ],
+ [
+ -2.645643728909444,
+ -2.5694844719173506,
+ -2.465234027606743,
+ -2.311880023774483,
+ -2.0532194086137463,
+ -1.443225906235189,
+ 0.6483856170166362,
+ 2.3843820398962725,
+ 3.118963530373582,
+ -2.993432632857962,
+ 3.141592653589793,
+ 2.993432632857962,
+ -3.118963530373581,
+ -2.3843820398962716,
+ -0.6483856170166309,
+ 1.443225906235189,
+ 2.0532194086137467,
+ 2.3118800237744837,
+ 2.465234027606743,
+ 2.569484471917351
+ ],
+ [
+ -2.8261136861471927,
+ -2.7622355743700924,
+ -2.6693222456396444,
+ -2.5246820229039897,
+ -2.2789963638011783,
+ -1.837701338730401,
+ -1.271532381970223,
+ 2.9229237077158516,
+ 3.0590736991568117,
+ -3.1316931385388314,
+ 3.141592653589793,
+ 3.1316931385388314,
+ -3.0590736991568113,
+ -2.9229237077158516,
+ 1.2715323819702242,
+ 1.837701338730401,
+ 2.2789963638011788,
+ 2.52468202290399,
+ 2.6693222456396444,
+ 2.7622355743700924
+ ],
+ [
+ -3.023487577664731,
+ -2.9823603407880452,
+ -2.9212074275700854,
+ -2.829289326425116,
+ -2.6971824979469106,
+ -2.5535900500422257,
+ -2.5919939811175885,
+ -2.983510359583328,
+ 3.1288351517956423,
+ 3.1351928228845756,
+ 3.141592653589793,
+ -3.1351928228845756,
+ -3.1288351517956423,
+ 2.983510359583328,
+ 2.591993981117588,
+ 2.5535900500422257,
+ 2.6971824979469106,
+ 2.8292893264251164,
+ 2.9212074275700854,
+ 2.9823603407880457
+ ],
+ [
+ 3.0499959394543317,
+ 3.0613349375809773,
+ 3.0797067165077303,
+ 3.1054991863539962,
+ 3.1319633602435557,
+ 3.1338529298787776,
+ 3.0753880432353493,
+ 3.0101955219347194,
+ 3.0698925700574997,
+ -3.132287058493909,
+ 3.141592653589793,
+ 3.132287058493909,
+ -3.0698925700574997,
+ -3.0101955219347194,
+ -3.0753880432353498,
+ -3.1338529298787776,
+ -3.1319633602435557,
+ -3.1054991863539962,
+ -3.0797067165077303,
+ -3.0613349375809773
+ ],
+ [
+ 2.8351902550287136,
+ 2.8146653638528387,
+ 2.7890540611294123,
+ 2.7532907003395364,
+ 2.697694606579379,
+ 2.6107932984217377,
+ 2.5060238246872295,
+ 2.519924728841944,
+ 3.0025171096032333,
+ -2.9826656153535533,
+ 3.141592653589793,
+ 2.9826656153535533,
+ -3.002517109603232,
+ -2.519924728841944,
+ -2.50602382468723,
+ -2.6107932984217377,
+ -2.697694606579379,
+ -2.753290700339537,
+ -2.7890540611294123,
+ -2.8146653638528387
+ ],
+ [
+ 2.62300568568022,
+ 2.572641150127677,
+ 2.507721498985002,
+ 2.4200921888899223,
+ 2.297126048083562,
+ 2.121792222401915,
+ 1.874530812637483,
+ 1.5208964174909685,
+ -1.4657186820544412,
+ -2.4272531781355995,
+ 3.141592653589793,
+ 2.4272531781355986,
+ 1.4657186820544328,
+ -1.520896417490969,
+ -1.8745308126374836,
+ -2.121792222401915,
+ -2.297126048083562,
+ -2.4200921888899227,
+ -2.507721498985002,
+ -2.572641150127677
+ ],
+ [
+ 2.4201304767038883,
+ 2.344639931899525,
+ 2.2483205650770213,
+ 2.1214057374278976,
+ 1.9485891606242582,
+ 1.7042911602467803,
+ 1.3361860212358623,
+ 0.7004016460681185,
+ -0.46836193902262313,
+ -1.7414003598306993,
+ 3.141592653589793,
+ 1.7414003598306982,
+ 0.4683619390226199,
+ -0.7004016460681193,
+ -1.3361860212358634,
+ -1.7042911602467803,
+ -1.9485891606242585,
+ -2.1214057374278976,
+ -2.2483205650770213,
+ -2.344639931899525
+ ],
+ [
+ 2.231427888342218,
+ 2.136907984558999,
+ 2.018641820260011,
+ 1.8671272570806778,
+ 1.6680768421672063,
+ 1.3990361754666933,
+ 1.0232631837061628,
+ 0.4898436636926278,
+ -0.20382309355718595,
+ -0.9204944144947594,
+ 0,
+ 0.9204944144947588,
+ 0.2038230935571842,
+ -0.48984366369262844,
+ -1.0232631837061639,
+ -1.3990361754666933,
+ -1.6680768421672065,
+ -1.8671272570806785,
+ -2.018641820260011,
+ -2.136907984558999
+ ],
+ [
+ 2.0596872946770617,
+ 1.9524318456319356,
+ 1.8214544391779321,
+ 1.6591153629896418,
+ 1.4552212195061538,
+ 1.1968793307934893,
+ 0.871083612773493,
+ 0.47796809828707887,
+ 0.06726479190373512,
+ -0.19879332327686808,
+ 0,
+ 0.198793323276868,
+ -0.0672647919037359,
+ -0.4779680982870793,
+ -0.8710836127734938,
+ -1.1968793307934893,
+ -1.4552212195061542,
+ -1.6591153629896422,
+ -1.8214544391779321,
+ -1.9524318456319358
+ ],
+ [
+ 1.9057846652621617,
+ 1.7913463835055852,
+ 1.65519839553125,
+ 1.492159283278173,
+ 1.2965503926589903,
+ 1.0636416455798035,
+ 0.7937610765214974,
+ 0.5014354698769212,
+ 0.22895862745665838,
+ 0.049267158699842856,
+ 0,
+ -0.04926715869984299,
+ -0.22895862745665885,
+ -0.5014354698769217,
+ -0.7937610765214982,
+ -1.0636416455798035,
+ -1.2965503926589907,
+ -1.4921592832781734,
+ -1.65519839553125,
+ -1.7913463835055852
+ ],
+ [
+ 1.7691350026439647,
+ 1.6518166456756285,
+ 1.515725369843054,
+ 1.3578638806199894,
+ 1.1758758953575827,
+ 0.9695574022962764,
+ 0.743635541194303,
+ 0.511581380907861,
+ 0.2974082676540457,
+ 0.1268805177889847,
+ 0,
+ -0.12688051778898488,
+ -0.2974082676540463,
+ -0.5115813809078614,
+ -0.7436355411943033,
+ -0.9695574022962764,
+ -1.175875895357583,
+ -1.3578638806199899,
+ -1.515725369843054,
+ -1.6518166456756287
+ ],
+ [
+ 1.6482580941247547,
+ 1.5310393598547667,
+ 1.3981076615937904,
+ 1.2480165052693624,
+ 1.0803126176232982,
+ 0.8965589837733227,
+ 0.7016629269570557,
+ 0.5048051118137127,
+ 0.31812740670736334,
+ 0.1508119217794788,
+ 0,
+ -0.15081192177947886,
+ -0.3181274067073635,
+ -0.5048051118137128,
+ -0.7016629269570561,
+ -0.8965589837733227,
+ -1.0803126176232987,
+ -1.2480165052693626,
+ -1.3981076615937904,
+ -1.5310393598547667
+ ]
+ ],
+ "opacityscale": [
+ [
+ 0,
+ 0
+ ],
+ [
+ 0.125,
+ 0.2
+ ],
+ [
+ 0.25,
+ 0.5
+ ],
+ [
+ 0.375,
+ 0.8
+ ],
+ [
+ 0.5,
+ 1
+ ],
+ [
+ 0.625,
+ 0.8
+ ],
+ [
+ 0.75,
+ 0.5
+ ],
+ [
+ 0.875,
+ 0.2
+ ],
+ [
+ 1,
+ 0
+ ]
+ ],
+ "colorscale": [
+ [
+ 0,
+ "#F00"
+ ],
+ [
+ 0.1666,
+ "#FF0"
+ ],
+ [
+ 0.3333,
+ "#0F0"
+ ],
+ [
+ 0.5,
+ "#0FF"
+ ],
+ [
+ 0.6666,
+ "#00F"
+ ],
+ [
+ 0.8333,
+ "#F0F"
+ ],
+ [
+ 1,
+ "#F00"
+ ]
+ ],
+ "cmin": -3.1351928228845756,
+ "cmax": 3.141592653589793
+ }
+ ],
+ "layout": {
+ "scene": {
+ "aspectratio": {
+ "x": 1,
+ "y": 1,
+ "z": 1
+ }
+ },
+ "width": 600,
+ "height": 800
+ }
+}
diff --git a/test/image/mocks/gl3d_surface_opacity-and-opacityscale.json b/test/image/mocks/gl3d_surface_opacity-and-opacityscale.json
new file mode 100644
index 00000000000..cee9e18938c
--- /dev/null
+++ b/test/image/mocks/gl3d_surface_opacity-and-opacityscale.json
@@ -0,0 +1,333 @@
+{
+ "data": [
+ {
+ "type": "surface",
+ "name": "opacity: 1
opacityscale: max",
+ "coloraxis": "coloraxis",
+ "opacityscale": "max",
+ "opacity": 1,
+ "contours": {
+ "z": {
+ "show": true
+ }
+ },
+ "x": [
+ 0,
+ 0.25,
+ 0.5,
+ 0.75,
+ 1
+ ],
+ "y": [
+ 0,
+ 0.25,
+ 0.5,
+ 0.75,
+ 1
+ ],
+ "z": [
+ [
+ 0,
+ 0,
+ 0,
+ 0,
+ 0
+ ],
+ [
+ 0,
+ 0.1,
+ 0.8,
+ 0.7,
+ 0
+ ],
+ [
+ 0,
+ 0.2,
+ 0,
+ 0.6,
+ 0
+ ],
+ [
+ 0,
+ 0.3,
+ 0.4,
+ 0.5,
+ 0
+ ],
+ [
+ 0,
+ 0,
+ 0,
+ 0,
+ 0
+ ]
+ ]
+ },
+ {
+ "scene": "scene2",
+ "name": "opacity: 0.5
opacityscale: max",
+ "type": "surface",
+ "coloraxis": "coloraxis",
+ "opacityscale": "max",
+ "opacity": 0.5,
+ "contours": {
+ "z": {
+ "show": true
+ }
+ },
+ "x": [
+ 0,
+ 0.25,
+ 0.5,
+ 0.75,
+ 1
+ ],
+ "y": [
+ 0,
+ 0.25,
+ 0.5,
+ 0.75,
+ 1
+ ],
+ "z": [
+ [
+ 0,
+ 0,
+ 0,
+ 0,
+ 0
+ ],
+ [
+ 0,
+ 0.1,
+ 0.8,
+ 0.7,
+ 0
+ ],
+ [
+ 0,
+ 0.2,
+ 0,
+ 0.6,
+ 0
+ ],
+ [
+ 0,
+ 0.3,
+ 0.4,
+ 0.5,
+ 0
+ ],
+ [
+ 0,
+ 0,
+ 0,
+ 0,
+ 0
+ ]
+ ]
+ },
+ {
+ "scene": "scene3",
+ "type": "surface",
+ "name": "opacity: 1
opacityscale: min",
+ "coloraxis": "coloraxis",
+ "opacityscale": "min",
+ "opacity": 1,
+ "contours": {
+ "z": {
+ "show": true
+ }
+ },
+ "x": [
+ 0,
+ 0.25,
+ 0.5,
+ 0.75,
+ 1
+ ],
+ "y": [
+ 0,
+ 0.25,
+ 0.5,
+ 0.75,
+ 1
+ ],
+ "z": [
+ [
+ 0,
+ 0,
+ 0,
+ 0,
+ 0
+ ],
+ [
+ 0,
+ 0.1,
+ 0.8,
+ 0.7,
+ 0
+ ],
+ [
+ 0,
+ 0.2,
+ 0,
+ 0.6,
+ 0
+ ],
+ [
+ 0,
+ 0.3,
+ 0.4,
+ 0.5,
+ 0
+ ],
+ [
+ 0,
+ 0,
+ 0,
+ 0,
+ 0
+ ]
+ ]
+ },
+ {
+ "scene": "scene4",
+ "type": "surface",
+ "name": "opacity: 0.5
opacityscale: min",
+ "coloraxis": "coloraxis",
+ "opacityscale": "min",
+ "opacity": 0.5,
+ "contours": {
+ "z": {
+ "show": true
+ }
+ },
+ "x": [
+ 0,
+ 0.25,
+ 0.5,
+ 0.75,
+ 1
+ ],
+ "y": [
+ 0,
+ 0.25,
+ 0.5,
+ 0.75,
+ 1
+ ],
+ "z": [
+ [
+ 0,
+ 0,
+ 0,
+ 0,
+ 0
+ ],
+ [
+ 0,
+ 0.1,
+ 0.8,
+ 0.7,
+ 0
+ ],
+ [
+ 0,
+ 0.2,
+ 0,
+ 0.6,
+ 0
+ ],
+ [
+ 0,
+ 0.3,
+ 0.4,
+ 0.5,
+ 0
+ ],
+ [
+ 0,
+ 0,
+ 0,
+ 0,
+ 0
+ ]
+ ]
+ }
+ ],
+ "layout": {
+ "coloraxis": {
+ "colorscale": "Portland"
+ },
+ "title": {
+ "text": "surface with opacityscale and opacity"
+ },
+ "width": 600,
+ "height": 800,
+ "scene": {
+ "aspectratio": {
+ "x": 1,
+ "y": 1,
+ "z": 1
+ },
+ "domain": {
+ "x": [0, 0.5],
+ "y": [0.5, 1]
+ },
+ "camera": {
+ "projection": {
+ "type": "orthographic"
+ }
+ }
+ },
+ "scene2": {
+ "aspectratio": {
+ "x": 1,
+ "y": 1,
+ "z": 1
+ },
+ "domain": {
+ "x": [0.5, 1],
+ "y": [0.5, 1]
+ },
+ "camera": {
+ "projection": {
+ "type": "orthographic"
+ }
+ }
+ },
+ "scene3": {
+ "aspectratio": {
+ "x": 1,
+ "y": 1,
+ "z": 1
+ },
+ "domain": {
+ "x": [0, 0.5],
+ "y": [0, 0.5]
+ },
+ "camera": {
+ "projection": {
+ "type": "orthographic"
+ }
+ }
+ },
+ "scene4": {
+ "aspectratio": {
+ "x": 1,
+ "y": 1,
+ "z": 1
+ },
+ "domain": {
+ "x": [0.5, 1],
+ "y": [0, 0.5]
+ },
+ "camera": {
+ "projection": {
+ "type": "orthographic"
+ }
+ }
+ }
+ }
+}
diff --git a/test/image/mocks/gl3d_surface_opacity_match_mesh3d.json b/test/image/mocks/gl3d_surface_opacity_match_mesh3d.json
new file mode 100644
index 00000000000..2b5f5f7f360
--- /dev/null
+++ b/test/image/mocks/gl3d_surface_opacity_match_mesh3d.json
@@ -0,0 +1,147 @@
+{
+ "data": [
+ {
+ "x": [
+ -1,
+ 1,
+ -1,
+ 1
+ ],
+ "y": [
+ -1,
+ -1,
+ 1,
+ 1
+ ],
+ "z": [
+ 0,
+ 0,
+ 0,
+ 0
+ ],
+ "i": [
+ 0,
+ 3
+ ],
+ "j": [
+ 1,
+ 2
+ ],
+ "k": [
+ 3,
+ 0
+ ],
+ "flatshading": true,
+ "lightposition": {
+ "x": 1000,
+ "y": 1000,
+ "z": 0
+ },
+ "color": "red",
+ "opacity": 0.5,
+ "type": "mesh3d",
+ "name": "mesh3d",
+ "scene": "scene1"
+ },
+ {
+ "x": [
+ -1,
+ 0,
+ 1
+ ],
+ "y": [
+ -1,
+ 0,
+ 1
+ ],
+ "z": [
+ [
+ 0,
+ 0,
+ 0
+ ],
+ [
+ 0,
+ 0,
+ 0
+ ],
+ [
+ 0,
+ 0,
+ 0
+ ]
+ ],
+ "lightposition": {
+ "x": 1000,
+ "y": 1000,
+ "z": 0
+ },
+ "showscale": false,
+ "colorscale": [
+ [
+ 0,
+ "red"
+ ],
+ [
+ 1,
+ "red"
+ ]
+ ],
+ "opacity": 0.5,
+ "type": "surface",
+ "name": "surface",
+ "scene": "scene2"
+ }
+ ],
+ "layout": {
+ "title": {
+ "text": "surface and mesh3d with half opacity"
+ },
+ "width": 400,
+ "height": 600,
+ "scene1": {
+ "aspectratio": {
+ "x": 1,
+ "y": 1,
+ "z": 1
+ },
+ "camera": {
+ "projection": {
+ "type": "orthographic"
+ }
+ },
+ "domain": {
+ "x": [
+ 0,
+ 1
+ ],
+ "y": [
+ 0,
+ 0.5
+ ]
+ }
+ },
+ "scene2": {
+ "aspectratio": {
+ "x": 1,
+ "y": 1,
+ "z": 1
+ },
+ "camera": {
+ "projection": {
+ "type": "orthographic"
+ }
+ },
+ "domain": {
+ "x": [
+ 0,
+ 1
+ ],
+ "y": [
+ 0.5,
+ 1
+ ]
+ }
+ }
+ }
+}
diff --git a/test/image/mocks/gl3d_surface_opacityscale_contour.json b/test/image/mocks/gl3d_surface_opacityscale_contour.json
new file mode 100644
index 00000000000..a79bfda5e0d
--- /dev/null
+++ b/test/image/mocks/gl3d_surface_opacityscale_contour.json
@@ -0,0 +1,144 @@
+{
+ "data": [
+ {
+ "type": "surface",
+ "opacityscale": "min",
+ "colorscale": "Earth",
+ "colorbar": {
+ "title": "fade top",
+ "len": 0.5,
+ "y": 0.0,
+ "yanchor": "bottom"
+ },
+ "contours": {
+ "x": { "show": false, "start": 2.2, "end": 3.81, "size": 0.4 },
+ "y": { "show": false, "start": 3.2, "end": 3.81, "size": 0.2 },
+ "z": { "show": true, "start": 0.1, "end": 0.41, "size": 0.1 }
+ },
+ "x": [1, 2, 3, 4, 5],
+ "y": [1, 2, 3 ,4, 5],
+ "z": [
+ [0, 1, 0, 1, 0],
+ [1, 0, 1, 0, 1],
+ [0, 1, 0, 1, 0],
+ [1, 0, 1, 0, 1],
+ [0, 1, 0, 1, 0]
+ ]
+ },
+ {
+ "type": "surface",
+ "opacityscale": "max",
+ "colorbar": {
+ "title": "fade bottom",
+ "len": 0.5,
+ "y": 0.5,
+ "yanchor": "bottom"
+ },
+ "contours": {
+ "x": { "show": true, "start": 1.0, "end": 2.01, "size": 0.25},
+ "y": { "show": true, "start": -2.0, "end": -1.01, "size": 0.25},
+ "z": { "show": true, "start": 1.0, "end": 1.41, "size": 0.10}
+ },
+ "x": [
+ [0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000],
+ [0.201,0.198,0.190,0.178,0.161,0.142,0.121,0.100,0.080,0.064,0.051,0.043,0.040,0.043,0.051,0.064,0.080,0.100,0.121,0.142,0.161,0.178,0.190,0.198,0.201],
+ [0.361,0.356,0.342,0.319,0.289,0.254,0.217,0.179,0.144,0.114,0.092,0.077,0.072,0.077,0.092,0.114,0.144,0.179,0.217,0.254,0.289,0.319,0.342,0.356,0.361],
+ [0.442,0.436,0.418,0.390,0.354,0.311,0.265,0.219,0.177,0.140,0.112,0.094,0.088,0.094,0.112,0.140,0.177,0.219,0.265,0.311,0.354,0.390,0.418,0.436,0.442],
+ [0.417,0.411,0.394,0.368,0.333,0.293,0.250,0.207,0.167,0.132,0.106,0.089,0.083,0.089,0.106,0.132,0.167,0.207,0.250,0.293,0.333,0.368,0.394,0.411,0.417],
+ [0.270,0.266,0.255,0.238,0.216,0.190,0.162,0.134,0.108,0.086,0.068,0.058,0.054,0.058,0.068,0.086,0.108,0.134,0.162,0.190,0.216,0.238,0.255,0.266,0.270],
+ [0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000],
+ [-0.377,-0.372,-0.357,-0.333,-0.302,-0.266,-0.226,-0.187,-0.151,-0.120,-0.096,-0.081,-0.075,-0.081,-0.096,-0.120,-0.151,-0.187,-0.226,-0.266,-0.302,-0.333,-0.357,-0.372,-0.377],
+ [-0.833,-0.822,-0.789,-0.736,-0.667,-0.586,-0.500,-0.414,-0.333,-0.264,-0.211,-0.178,-0.167,-0.178,-0.211,-0.264,-0.333,-0.414,-0.500,-0.586,-0.667,-0.736,-0.789,-0.822,-0.833],
+ [-1.326,-1.308,-1.255,-1.170,-1.061,-0.933,-0.795,-0.658,-0.530,-0.420,-0.336,-0.283,-0.265,-0.283,-0.336,-0.420,-0.530,-0.658,-0.795,-0.933,-1.061,-1.170,-1.255,-1.308,-1.326],
+ [-1.804,-1.780,-1.708,-1.593,-1.443,-1.269,-1.083,-0.896,-0.722,-0.572,-0.458,-0.385,-0.361,-0.385,-0.458,-0.572,-0.722,-0.896,-1.083,-1.269,-1.443,-1.593,-1.708,-1.780,-1.804],
+ [-2.214,-2.183,-2.095,-1.954,-1.771,-1.557,-1.328,-1.099,-0.885,-0.702,-0.561,-0.473,-0.443,-0.473,-0.561,-0.702,-0.885,-1.099,-1.328,-1.557,-1.771,-1.954,-2.095,-2.183,-2.214],
+ [-2.500,-2.466,-2.366,-2.207,-2.000,-1.759,-1.500,-1.241,-1.000,-0.793,-0.634,-0.534,-0.500,-0.534,-0.634,-0.793,-1.000,-1.241,-1.500,-1.759,-2.000,-2.207,-2.366,-2.466,-2.500],
+ [-2.616,-2.580,-2.476,-2.310,-2.093,-1.840,-1.570,-1.299,-1.046,-0.830,-0.663,-0.559,-0.523,-0.559,-0.663,-0.830,-1.046,-1.299,-1.570,-1.840,-2.093,-2.310,-2.476,-2.580,-2.616],
+ [-2.526,-2.491,-2.391,-2.230,-2.021,-1.777,-1.516,-1.254,-1.010,-0.801,-0.641,-0.540,-0.505,-0.540,-0.641,-0.801,-1.010,-1.254,-1.516,-1.777,-2.021,-2.230,-2.391,-2.491,-2.526],
+ [-2.210,-2.180,-2.091,-1.951,-1.768,-1.555,-1.326,-1.097,-0.884,-0.701,-0.560,-0.472,-0.442,-0.472,-0.560,-0.701,-0.884,-1.097,-1.326,-1.555,-1.768,-1.951,-2.091,-2.180,-2.210],
+ [-1.667,-1.644,-1.577,-1.471,-1.333,-1.173,-1.000,-0.827,-0.667,-0.529,-0.423,-0.356,-0.333,-0.356,-0.423,-0.529,-0.667,-0.827,-1.000,-1.173,-1.333,-1.471,-1.577,-1.644,-1.667],
+ [-0.917,-0.904,-0.868,-0.809,-0.733,-0.645,-0.550,-0.455,-0.367,-0.291,-0.232,-0.196,-0.183,-0.196,-0.232,-0.291,-0.367,-0.455,-0.550,-0.645,-0.733,-0.809,-0.868,-0.904,-0.917],
+ [-0.000,-0.000,-0.000,-0.000,-0.000,-0.000,-0.000,-0.000,-0.000,-0.000,-0.000,-0.000,-0.000,-0.000,-0.000,-0.000,-0.000,-0.000,-0.000,-0.000,-0.000,-0.000,-0.000,-0.000,-0.000],
+ [1.024,1.011,0.970,0.904,0.820,0.721,0.615,0.509,0.410,0.325,0.260,0.219,0.205,0.219,0.260,0.325,0.410,0.509,0.615,0.721,0.820,0.904,0.970,1.011,1.024],
+ [2.083,2.055,1.972,1.839,1.667,1.466,1.250,1.034,0.833,0.661,0.528,0.445,0.417,0.445,0.528,0.661,0.833,1.034,1.250,1.466,1.667,1.839,1.972,2.055,2.083],
+ [3.094,3.051,2.928,2.731,2.475,2.176,1.856,1.536,1.237,0.981,0.785,0.661,0.619,0.661,0.785,0.981,1.237,1.536,1.856,2.176,2.475,2.731,2.928,3.051,3.094],
+ [3.969,3.915,3.757,3.504,3.175,2.793,2.382,1.971,1.588,1.259,1.007,0.848,0.794,0.848,1.007,1.259,1.588,1.971,2.382,2.793,3.175,3.504,3.757,3.915,3.969],
+ [4.628,4.565,4.380,4.086,3.703,3.256,2.777,2.298,1.851,1.468,1.174,0.989,0.926,0.989,1.174,1.468,1.851,2.298,2.777,3.256,3.703,4.086,4.380,4.565,4.628],
+ [5.000,4.932,4.732,4.414,4.000,3.518,3.000,2.482,2.000,1.586,1.268,1.068,1.000,1.068,1.268,1.586,2.000,2.482,3.000,3.518,4.000,4.414,4.732,4.932,5.000]
+ ],
+ "y": [
+ [0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000],
+ [0.054,0.053,0.051,0.048,0.043,0.038,0.032,0.027,0.022,0.017,0.014,0.012,0.011,0.012,0.014,0.017,0.022,0.027,0.032,0.038,0.043,0.048,0.051,0.053,0.054],
+ [0.208,0.205,0.197,0.184,0.167,0.147,0.125,0.103,0.083,0.066,0.053,0.045,0.042,0.045,0.053,0.066,0.083,0.103,0.125,0.147,0.167,0.184,0.197,0.205,0.208],
+ [0.442,0.436,0.418,0.390,0.354,0.311,0.265,0.219,0.177,0.140,0.112,0.094,0.088,0.094,0.112,0.140,0.177,0.219,0.265,0.311,0.354,0.390,0.418,0.436,0.442],
+ [0.722,0.712,0.683,0.637,0.577,0.508,0.433,0.358,0.289,0.229,0.183,0.154,0.144,0.154,0.183,0.229,0.289,0.358,0.433,0.508,0.577,0.637,0.683,0.712,0.722],
+ [1.006,0.992,0.952,0.888,0.805,0.708,0.604,0.500,0.402,0.319,0.255,0.215,0.201,0.215,0.255,0.319,0.402,0.500,0.604,0.708,0.805,0.888,0.952,0.992,1.006],
+ [1.250,1.233,1.183,1.104,1.000,0.879,0.750,0.621,0.500,0.396,0.317,0.267,0.250,0.267,0.317,0.396,0.500,0.621,0.750,0.879,1.000,1.104,1.183,1.233,1.250],
+ [1.409,1.389,1.333,1.244,1.127,0.991,0.845,0.699,0.563,0.447,0.357,0.301,0.282,0.301,0.357,0.447,0.563,0.699,0.845,0.991,1.127,1.244,1.333,1.389,1.409],
+ [1.443,1.424,1.366,1.274,1.155,1.015,0.866,0.717,0.577,0.458,0.366,0.308,0.289,0.308,0.366,0.458,0.577,0.717,0.866,1.015,1.155,1.274,1.366,1.424,1.443],
+ [1.326,1.308,1.255,1.170,1.061,0.933,0.795,0.658,0.530,0.420,0.336,0.283,0.265,0.283,0.336,0.420,0.530,0.658,0.795,0.933,1.061,1.170,1.255,1.308,1.326],
+ [1.042,1.027,0.986,0.920,0.833,0.733,0.625,0.517,0.417,0.330,0.264,0.223,0.208,0.223,0.264,0.330,0.417,0.517,0.625,0.733,0.833,0.920,0.986,1.027,1.042],
+ [0.593,0.585,0.561,0.524,0.475,0.417,0.356,0.294,0.237,0.188,0.150,0.127,0.119,0.127,0.150,0.188,0.237,0.294,0.356,0.417,0.475,0.524,0.561,0.585,0.593],
+ [0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000],
+ [-0.701,-0.691,-0.663,-0.619,-0.561,-0.493,-0.421,-0.348,-0.280,-0.222,-0.178,-0.150,-0.140,-0.150,-0.178,-0.222,-0.280,-0.348,-0.421,-0.493,-0.561,-0.619,-0.663,-0.691,-0.701],
+ [-1.458,-1.438,-1.380,-1.287,-1.167,-1.026,-0.875,-0.724,-0.583,-0.463,-0.370,-0.312,-0.292,-0.312,-0.370,-0.463,-0.583,-0.724,-0.875,-1.026,-1.167,-1.287,-1.380,-1.438,-1.458],
+ [-2.210,-2.180,-2.091,-1.951,-1.768,-1.555,-1.326,-1.097,-0.884,-0.701,-0.560,-0.472,-0.442,-0.472,-0.560,-0.701,-0.884,-1.097,-1.326,-1.555,-1.768,-1.951,-2.091,-2.180,-2.210],
+ [-2.887,-2.847,-2.732,-2.549,-2.309,-2.031,-1.732,-1.433,-1.155,-0.916,-0.732,-0.617,-0.577,-0.617,-0.732,-0.916,-1.155,-1.433,-1.732,-2.031,-2.309,-2.549,-2.732,-2.847,-2.887],
+ [-3.421,-3.374,-3.238,-3.020,-2.737,-2.407,-2.053,-1.698,-1.368,-1.085,-0.868,-0.731,-0.684,-0.731,-0.868,-1.085,-1.368,-1.698,-2.053,-2.407,-2.737,-3.020,-3.238,-3.374,-3.421],
+ [-3.750,-3.699,-3.549,-3.311,-3.000,-2.638,-2.250,-1.862,-1.500,-1.189,-0.951,-0.801,-0.750,-0.801,-0.951,-1.189,-1.500,-1.862,-2.250,-2.638,-3.000,-3.311,-3.549,-3.699,-3.750],
+ [-3.823,-3.771,-3.619,-3.376,-3.059,-2.690,-2.294,-1.898,-1.529,-1.213,-0.970,-0.817,-0.765,-0.817,-0.970,-1.213,-1.529,-1.898,-2.294,-2.690,-3.059,-3.376,-3.619,-3.771,-3.823],
+ [-3.608,-3.559,-3.415,-3.186,-2.887,-2.539,-2.165,-1.791,-1.443,-1.144,-0.915,-0.771,-0.722,-0.771,-0.915,-1.144,-1.443,-1.791,-2.165,-2.539,-2.887,-3.186,-3.415,-3.559,-3.608],
+ [-3.094,-3.051,-2.928,-2.731,-2.475,-2.176,-1.856,-1.536,-1.237,-0.981,-0.785,-0.661,-0.619,-0.661,-0.785,-0.981,-1.237,-1.536,-1.856,-2.176,-2.475,-2.731,-2.928,-3.051,-3.094],
+ [-2.292,-2.260,-2.169,-2.023,-1.833,-1.612,-1.375,-1.138,-0.917,-0.727,-0.581,-0.490,-0.458,-0.490,-0.581,-0.727,-0.917,-1.138,-1.375,-1.612,-1.833,-2.023,-2.169,-2.260,-2.292],
+ [-1.240,-1.223,-1.174,-1.095,-0.992,-0.872,-0.744,-0.616,-0.496,-0.393,-0.314,-0.265,-0.248,-0.265,-0.314,-0.393,-0.496,-0.616,-0.744,-0.872,-0.992,-1.095,-1.174,-1.223,-1.240],
+ [-0.000,-0.000,-0.000,-0.000,-0.000,-0.000,-0.000,-0.000,-0.000,-0.000,-0.000,-0.000,-0.000,-0.000,-0.000,-0.000,-0.000,-0.000,-0.000,-0.000,-0.000,-0.000,-0.000,-0.000,-0.000]
+ ],
+ "z": [
+ [1.000,1.259,1.500,1.707,1.866,1.966,2.000,1.966,1.866,1.707,1.500,1.259,1.000,0.741,0.500,0.293,0.134,0.034,0.000,0.034,0.134,0.293,0.500,0.741,1.000],
+ [1.000,1.259,1.500,1.707,1.866,1.966,2.000,1.966,1.866,1.707,1.500,1.259,1.000,0.741,0.500,0.293,0.134,0.034,0.000,0.034,0.134,0.293,0.500,0.741,1.000],
+ [1.000,1.259,1.500,1.707,1.866,1.966,2.000,1.966,1.866,1.707,1.500,1.259,1.000,0.741,0.500,0.293,0.134,0.034,0.000,0.034,0.134,0.293,0.500,0.741,1.000],
+ [1.000,1.259,1.500,1.707,1.866,1.966,2.000,1.966,1.866,1.707,1.500,1.259,1.000,0.741,0.500,0.293,0.134,0.034,0.000,0.034,0.134,0.293,0.500,0.741,1.000],
+ [1.000,1.259,1.500,1.707,1.866,1.966,2.000,1.966,1.866,1.707,1.500,1.259,1.000,0.741,0.500,0.293,0.134,0.034,0.000,0.034,0.134,0.293,0.500,0.741,1.000],
+ [1.000,1.259,1.500,1.707,1.866,1.966,2.000,1.966,1.866,1.707,1.500,1.259,1.000,0.741,0.500,0.293,0.134,0.034,0.000,0.034,0.134,0.293,0.500,0.741,1.000],
+ [1.000,1.259,1.500,1.707,1.866,1.966,2.000,1.966,1.866,1.707,1.500,1.259,1.000,0.741,0.500,0.293,0.134,0.034,0.000,0.034,0.134,0.293,0.500,0.741,1.000],
+ [1.000,1.259,1.500,1.707,1.866,1.966,2.000,1.966,1.866,1.707,1.500,1.259,1.000,0.741,0.500,0.293,0.134,0.034,0.000,0.034,0.134,0.293,0.500,0.741,1.000],
+ [1.000,1.259,1.500,1.707,1.866,1.966,2.000,1.966,1.866,1.707,1.500,1.259,1.000,0.741,0.500,0.293,0.134,0.034,0.000,0.034,0.134,0.293,0.500,0.741,1.000],
+ [1.000,1.259,1.500,1.707,1.866,1.966,2.000,1.966,1.866,1.707,1.500,1.259,1.000,0.741,0.500,0.293,0.134,0.034,0.000,0.034,0.134,0.293,0.500,0.741,1.000],
+ [1.000,1.259,1.500,1.707,1.866,1.966,2.000,1.966,1.866,1.707,1.500,1.259,1.000,0.741,0.500,0.293,0.134,0.034,0.000,0.034,0.134,0.293,0.500,0.741,1.000],
+ [1.000,1.259,1.500,1.707,1.866,1.966,2.000,1.966,1.866,1.707,1.500,1.259,1.000,0.741,0.500,0.293,0.134,0.034,0.000,0.034,0.134,0.293,0.500,0.741,1.000],
+ [1.000,1.259,1.500,1.707,1.866,1.966,2.000,1.966,1.866,1.707,1.500,1.259,1.000,0.741,0.500,0.293,0.134,0.034,0.000,0.034,0.134,0.293,0.500,0.741,1.000],
+ [1.000,1.259,1.500,1.707,1.866,1.966,2.000,1.966,1.866,1.707,1.500,1.259,1.000,0.741,0.500,0.293,0.134,0.034,0.000,0.034,0.134,0.293,0.500,0.741,1.000],
+ [1.000,1.259,1.500,1.707,1.866,1.966,2.000,1.966,1.866,1.707,1.500,1.259,1.000,0.741,0.500,0.293,0.134,0.034,0.000,0.034,0.134,0.293,0.500,0.741,1.000],
+ [1.000,1.259,1.500,1.707,1.866,1.966,2.000,1.966,1.866,1.707,1.500,1.259,1.000,0.741,0.500,0.293,0.134,0.034,0.000,0.034,0.134,0.293,0.500,0.741,1.000],
+ [1.000,1.259,1.500,1.707,1.866,1.966,2.000,1.966,1.866,1.707,1.500,1.259,1.000,0.741,0.500,0.293,0.134,0.034,0.000,0.034,0.134,0.293,0.500,0.741,1.000],
+ [1.000,1.259,1.500,1.707,1.866,1.966,2.000,1.966,1.866,1.707,1.500,1.259,1.000,0.741,0.500,0.293,0.134,0.034,0.000,0.034,0.134,0.293,0.500,0.741,1.000],
+ [1.000,1.259,1.500,1.707,1.866,1.966,2.000,1.966,1.866,1.707,1.500,1.259,1.000,0.741,0.500,0.293,0.134,0.034,0.000,0.034,0.134,0.293,0.500,0.741,1.000],
+ [1.000,1.259,1.500,1.707,1.866,1.966,2.000,1.966,1.866,1.707,1.500,1.259,1.000,0.741,0.500,0.293,0.134,0.034,0.000,0.034,0.134,0.293,0.500,0.741,1.000],
+ [1.000,1.259,1.500,1.707,1.866,1.966,2.000,1.966,1.866,1.707,1.500,1.259,1.000,0.741,0.500,0.293,0.134,0.034,0.000,0.034,0.134,0.293,0.500,0.741,1.000],
+ [1.000,1.259,1.500,1.707,1.866,1.966,2.000,1.966,1.866,1.707,1.500,1.259,1.000,0.741,0.500,0.293,0.134,0.034,0.000,0.034,0.134,0.293,0.500,0.741,1.000],
+ [1.000,1.259,1.500,1.707,1.866,1.966,2.000,1.966,1.866,1.707,1.500,1.259,1.000,0.741,0.500,0.293,0.134,0.034,0.000,0.034,0.134,0.293,0.500,0.741,1.000],
+ [1.000,1.259,1.500,1.707,1.866,1.966,2.000,1.966,1.866,1.707,1.500,1.259,1.000,0.741,0.500,0.293,0.134,0.034,0.000,0.034,0.134,0.293,0.500,0.741,1.000],
+ [1.000,1.259,1.500,1.707,1.866,1.966,2.000,1.966,1.866,1.707,1.500,1.259,1.000,0.741,0.500,0.293,0.134,0.034,0.000,0.034,0.134,0.293,0.500,0.741,1.000]
+ ]
+ }
+ ],
+ "layout": {
+ "title": "Surface with opacityscale",
+ "width": 900,
+ "height": 600,
+ "scene": {
+ "xaxis": { "nticks": 12 },
+ "yaxis": { "nticks": 12 },
+ "zaxis": { "nticks": 4 },
+ "camera": {
+ "eye": { "x": 1, "y": 0.25, "z": 0.5 },
+ "center": { "x": 0, "y": 0, "z": -0.25 }
+ },
+ "aspectratio": {
+ "x": 1,
+ "y": 1,
+ "z": 0.25
+ }
+ }
+ }
+}