Skip to content

Pass static argument to scene2d #980

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

Merged
merged 12 commits into from
Oct 13, 2016
Merged

Pass static argument to scene2d #980

merged 12 commits into from
Oct 13, 2016

Conversation

dy
Copy link
Contributor

@dy dy commented Sep 26, 2016

Merged along with this gl-vis/gl-plot2d#4 will remove image of picked data from rendered result

@etpinard
Copy link
Contributor

Sweet! Let me test it out.

@etpinard
Copy link
Contributor

@dfcreative I've got some news! Looks like you're almost there.

Most gl2d mocks can now be generated in a reproducible way!

Here's the list of mocks that are still problematic:

image

By looking at them quickly, all mocks in ⏫ have made up of one or more gl-line2d object. Maybe we'll need to bump the gl-shader dep there too?

@etpinard
Copy link
Contributor

For reference:

image

@etpinard
Copy link
Contributor

Wait @dfcreative does gl-plot2d need gl-shader@4.2.1 too?

@etpinard
Copy link
Contributor

Ok I just checked with

image

and more or less the same mocks are failing intermittently:

image

@dy
Copy link
Contributor Author

dy commented Sep 26, 2016

Yeah, eventually gl-shader@4.2.1 fixes errors in console, but resulting images still have bad dimensions, due to wrong canvas size etc, gotta check that the other day.

@dy
Copy link
Contributor Author

dy commented Sep 30, 2016

Ok, 2558160 fixes dimensions, so that initial case works. Sometimes though, toImage in some reason is invoked before plot, which skews everything.

@etpinard
Copy link
Contributor

@dfcreative great. I'll test this out this afternoon! Thanks!!


// check for resize
var canvas = this.canvas;
if(canvas.width !== pixelWidth || canvas.height !== pixelHeight) {
Copy link
Contributor Author

@dy dy Sep 30, 2016

Choose a reason for hiding this comment

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

This is duplicate of L131 and L374. Should I put it into a method updateSize?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, refactored so that now there is updateSize method

@etpinard
Copy link
Contributor

@dfcreative looking good!

See 052dc63 where I re-generated every gl2d test image. I think they all look good now.

I'm still getting some run-to-run inconsistencies when generating images in batch (we use a concurrency of 5 in our image test routine). BUT generating them one-after-another works like charm 🎉 (at least of my machine). In commit b321cb9 we'll see if that same is true on CircleCI.

@dy
Copy link
Contributor Author

dy commented Sep 30, 2016

What sort of inconsistencies?

The inconsistency I faced with is caused by occasional delay of initial scene.plot method, which in some reason sometimes is called after scene.toImage, so that rendered images have uninitialized content, same as real plots at the moment.
I did not manage to consistently reproduce that use-case, my laptop acclerates and initial delay becomes insufficient)

@etpinard
Copy link
Contributor

What sort of inconsistencies?

Sorry, I should've been clearer. For example, gl2d_10 when ran in batch yield

image

the baseline is on the left, the generated image on the right.

@etpinard
Copy link
Contributor

etpinard commented Sep 30, 2016

On CiricleCI, these mocks

image

are failing the image comparison test when ran in queue (i.e. with zero concurrency).

Note that the CircleCI machine is a little weaker than most laptops.

@etpinard
Copy link
Contributor

@dfcreative having to run the gl2d image tests with zero concurrency would be a great start. The only drawback would be slower test runs - which isn't that big of a deal at the moment.

So, figuring out why some gl2d mocks are having issues on CircleCI would be amazing.

@dy
Copy link
Contributor Author

dy commented Sep 30, 2016

Yes, I will check it out. Also the inconsistencies - these are the same I mentioned.

@etpinard
Copy link
Contributor

Also the inconsistencies - these are the same I mentioned.

Great. Thanks for the info. 👍

@dy
Copy link
Contributor Author

dy commented Sep 30, 2016

Hm. These examples, except for the gl2d_pointcloud-basic, look exactly the same as real plots. May I ask how do you get baseline images? They seem a bit taller than the rendered ones.
Baseline:
gl2d_simple_inset
Rendered:
image

@etpinard
Copy link
Contributor

etpinard commented Oct 3, 2016

May I ask how do you get baseline images?

Full docs ➡️ https://github.com/plotly/plotly.js/tree/master/test/image#c-generate-or-update-existing-baseline-image

@dy
Copy link
Contributor Author

dy commented Oct 3, 2016

The problem is that the baseline images are taller than the default plot height I get (500px vs 450px). These mocks do not have sizes in layout, so I guess streambed may just preset own defaults or something like that.
If to preset dimensions in mocks:

"layout": {
...
        "width": 700,
        "height": 500
}

Everything works fine. Shall we?

@etpinard
Copy link
Contributor

etpinard commented Oct 3, 2016

@dy
Copy link
Contributor Author

dy commented Oct 3, 2016

@monfera hi!

There seems to be a single mock failing, that is gl2d_pointcloud-basic.

The problem is when we try to read pixels from webgl in static canvas with disabled blending, they get mixed with gray-ish background or something like that.
Expected:
image
Actual:
image

What are the use-cases we may want to disable blend here? If we need solid color we can set "blend": true by default and set "color": "rgba(255, 0, 0, 1)" for example.

@etpinard
Copy link
Contributor

etpinard commented Oct 3, 2016

On CircleCI, gl2d_multiple_subplots is generated as

image

@monfera
Copy link
Contributor

monfera commented Oct 3, 2016

@dfcreative sorry to hear it's causing testing trouble. The blending is disabled here, the purpose was an approx. 2x speedup on shader performance, which mattered a lot on the 1m point user requirement case. Admittedly the comment could be more specific. It should be possible to specify blend: true in the attributes to let this test pass. Though I had image test running problems last time, I can help with a small PR enabling blending, please let me know if I should go ahead with it.

@dy
Copy link
Contributor Author

dy commented Oct 3, 2016

@monfera I would guess practically here can be two cases: if there is little data, then having blending enabled will give better results, whereas if there is 1m points, the precision of a single point does not matter and blending is better to be off.

Does it make any sense to detect blending dynamically?

@dy
Copy link
Contributor Author

dy commented Oct 3, 2016

@monfera is it ok to detect blending like that 0efb54e?
I am not sure about magic numbers, the guess is if there are more than 100 points then disable blend.

@monfera
Copy link
Contributor

monfera commented Oct 3, 2016

@dfcreative it's possible as we already have a handle on how many points are visible at any one time. (PS. just saw your commit which looks for the total number of points, and in gl-scatter2d we have the point count for the currently visible, on-screen points - with sufficient zooming you can always get to a handful of points even if you start with a million.)

One thing though, there can be a big difference in the rendered output even if there are lots of points. With proper blending, it's possible to have a density cloud effect but of course it comes with shader time expense.

@monfera
Copy link
Contributor

monfera commented Oct 3, 2016

@dfcreative replying to your question - the user wouldn't know why there's a difference in behavior and it's not explained in the attributes doc, so it should be made explicit. I usually ask @etpinard when it comes to API changes so I'd defer on this too. Also I see that you set blend to undefined and you check for null, is it how it works out, i.e. does coerce turn undefined to null? If so, it looks good.

@@ -75,7 +75,7 @@ module.exports = {
},
blend: {
valType: 'boolean',
dflt: false,
dflt: undefined,
Copy link
Contributor

Choose a reason for hiding this comment

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

we usually use null in situation like this one

this.pointcloudOptions.blend = options.marker.blend;

var blend = options.marker.blend;
if (blend == null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

... and (blend === null)

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

@etpinard
Copy link
Contributor

Merging.

I'll add the CI test command in a separate PR.

@etpinard etpinard merged commit 1bf4e3e into plotly:master Oct 13, 2016
etpinard added a commit that referenced this pull request Oct 13, 2016
- which are now reproducible
  via #980
etpinard added a commit that referenced this pull request Oct 13, 2016
- warn when gl2d are ran batch
- skip over multiple subplot test on CI, see
  #980
  for details
etpinard added a commit that referenced this pull request Oct 13, 2016
- warn when gl2d are ran batch
- skip over multiple subplot test on CI, see
  #980
  for details
etpinard added a commit that referenced this pull request Oct 13, 2016
- warn when gl2d are ran batch
- skip over multiple subplot test on CI, see
  #980
  for details
etpinard added a commit that referenced this pull request Oct 13, 2016
- warn when gl2d are ran batch
- skip over multiple subplot test on CI, see
  #980
  for details
etpinard added a commit that referenced this pull request Oct 13, 2016
- which are now reproducible
  via #980
etpinard added a commit that referenced this pull request Oct 13, 2016
- warn when gl2d are ran batch
- skip over multiple subplot test on CI, see
  #980
  for details
@etpinard etpinard added this to the On-par gl2d milestone Oct 13, 2016
@dy dy deleted the scene2d-static branch February 15, 2017 09:42
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.

3 participants