deck.gl icon indicating copy to clipboard operation
deck.gl copied to clipboard

heatmap layer shows only one color from colorRange

Open UttamRahane opened this issue 7 years ago • 31 comments

Description

Repro Steps

const heatMap_layer = new HeatmapLayer({ data: this.geoJson.features, id: 'heatmp-layer', opacity: 0.6, getPosition: d => d.geometry.coordinates, getWeight: d => d.properties['Max Capacity'], colorFormat: 'RGBA', colorRange: [[1, 152, 189, 255], [73, 227, 206, 255], [216, 254, 181, 255], [254, 237, 177, 255],[254, 173, 84, 255],[209, 55, 78, 255]], intensity: 1, radiusPixels: 80, threshold: 0.9 });

-->

Environment (please complete the following information):

  • Framework Version: [e.g. deck.gl 7.2.3]
  • Browser Version: [e.g. Chrome 71.0]
  • OS: [e.g. Mac OS X 10.4]

UttamRahane avatar Sep 10 '19 07:09 UttamRahane

Can you share result image? Which of the colors in colorRange are used? Also try adjusting radiusPixels and using default colorRange.

1chandu avatar Sep 10 '19 16:09 1chandu

image expected result should be something like -

image

There should be different color according to the value of 'Max capacity'

UttamRahane avatar Sep 11 '19 10:09 UttamRahane

using default colorRange, it shows only yellow color. that means it shows only first color.

UttamRahane avatar Sep 11 '19 10:09 UttamRahane

Based on your image it seems all the pixels are falling into lower end of heat map range. Locally I am not able to reproduce this problem, can you share your system details? Browser, GPU, OS (complete the environment section in description) ? Also can you minimize the issue to few data samples and share that data here?

1chandu avatar Sep 18 '19 18:09 1chandu

I am seeing this same issue with deck.gl v7.2.3 in Windows. It happens in both Chrome and Edge. It works as expected in Chrome on linux.

SterlingMcCall avatar Sep 18 '19 18:09 SterlingMcCall

Browser : Chrome Version 76.0.3809.132 GPU: Intel(R) UHD Graphics 620 OS: windows 10 I'm trying to implement it using Vue you can use geojson format and take value from properties

UttamRahane avatar Sep 19 '19 05:09 UttamRahane

This bug occurs on Windows when hardware acceleration is enabled regardless of graphics chipsets. I tested both Nvidia and Intel graphics in Chrome and Edge 18 (non-chromium Edge). To prove the issue, go to chrome://settings/system and disable the option titled "Use hardware acceleration when available" and the heatmap will behave normally.

Issue still present as of [email protected] and [email protected].

I do not know if this is a Chrome bug or a deck.gl bug, but it is definitely a bug.

SterlingMcCall avatar Sep 23 '19 14:09 SterlingMcCall

To reproduce this bug, just look at the heatmap demo in the documentation on a Windows machine with hardware acceleration enabled.

SterlingMcCall avatar Sep 23 '19 14:09 SterlingMcCall

@UttamRahane @SterlingMcCall can you load up this page on your systems and let us know the results: https://tsherif.github.io/webgl2-render-target-test/

It should look like this: Screen Shot 2019-09-23 at 12 32 52 PM

tsherif avatar Sep 23 '19 16:09 tsherif

The document page on chrome browser looks like: image On Edge: image @tsherif your page gives the same output as you expect but on chrome. On Edge it gives a message

This example requires WebGL 2 which is unavailable on this system.

UttamRahane avatar Sep 23 '19 17:09 UttamRahane

@UttamRahane @tsherif I misspoke about Edge. As would be expected, Edge does not work at all due to lack of WebGL2 support. I tried firefox on windows and observe the same issue with the same color everywhere, but disabling hardware acceleration in the firefox settings did not fix the issue like it did in Chrome.

@tsherif Testing https://tsherif.github.io/webgl2-render-target-test/ on a Windows 10 machine with Intel HD graphics:

  • Firefox with hardware acceleration - same as your screenshot
  • Firefox without hardware acceleration - same as your screenshot
  • Chrome with hardware acceleration - same as your screenshot
  • Chrome without hardware acceleration
    • red, black, black, black
    • red, red, red, red
    • red, red, red, red
  • Edge 18 - "This example requires WebGL 2 which is unavailable on this system."

SterlingMcCall avatar Sep 23 '19 17:09 SterlingMcCall

On the same windows 10 machine with Intel HD graphics on Edge 18 with [email protected] the heatmap displays this same visual issue seen on Chrome and Firefox.

SterlingMcCall avatar Sep 23 '19 17:09 SterlingMcCall

@SterlingMcCall , to summarize, when using [email protected], it is specific Windows only, and happens on all browsers (Edge, Chrome and Firefox) ? Also the issue is, it shows first color only from the colorRange and there are no crashes in console?

1chandu avatar Sep 23 '19 18:09 1chandu

@1chandu

to summarize, when using [email protected], it is specific Windows only, and happens on all browsers (Edge, Chrome and Firefox) ? Also the issue is, it shows first color only from the colorRange and there are no crashes in console?

Correct. That would be an mostly accurate summary. I would add the following:

  • WebGL 1.0 support was added in [email protected] allowing the bug to be seen in Edge, but previous versions of deck.gl also experience the same bug on WebGL 2.0 browsers. This would seem to rule out differences between 1.0 and 2.0.
  • Not only is the first color from the colorRange picked, the edges do not fade smoothly. The threshold property has no effect and does not soften around the edges as you would expect.
  • On Chrome, disabling hardware acceleration "fixes" the issue. Disabling hardware acceleration in Firefox has no effect. I could not figure out how to disable hardware acceleration in Edge if it is even possible to do so.
  • The bug is observed in Windows machines running either Intel HD or Nvidia graphics. I could not test on AMD hardware.

Could it be a Windows bug?

SterlingMcCall avatar Sep 23 '19 19:09 SterlingMcCall

@SterlingMcCall , thanks for the details.

We are also seeing a crash in iOS due to unsupported WebGL feature (render to float textures), I am working on a fix to fallback to unsigned byte textures (with low precession), given what you are seeing is not a crash but rendering artifact, that could be a different issue specific to windows browsers. I will take a look.

On Chrome, disabling hardware acceleration fixes the issue. Disabling hardware acceleration in Firefox has no effect. I was not able to determine if it is possible to disable hardware acceleration in Edge.

disabling hardware acceleration, uses software rendering (doesn't use GPU), so not limited by WebGL extension support. Firefox's software rendering might have bugs.

1chandu avatar Sep 23 '19 19:09 1chandu

@1chandu The bug indeed appears to be in ANGLE. The easiest way I found to test is in Firefox, go to about:config and set disable-angle to true. The heatmap layer rendered fine for me afterwards. I tried to disable ANGLE in Chrome as well, but the browser became unresponsive so I couldn't test.

If we narrow down the issue, we can report a bug here: https://bugs.chromium.org/p/angleproject/issues/list

tsherif avatar Sep 25 '19 12:09 tsherif

@tsherif , awesome !! I will dig more into this ..

1chandu avatar Sep 25 '19 16:09 1chandu

@SterlingMcCall @UttamRahane Can you try using deck.gl 7.3.0-beta.6, this includes few fixes for WebGL1 support. Also can you try following demos:

  1. maxWeightLog : https://codepen.io/1chandu1/pen/rNBRqRz
    => in console I am logging max weight, please copy paste the log
  2. custom maxWeight: https://codepen.io/1chandu1/pen/BaBbGxQ => use the maxWeight slider and see if you able to see full color spectrum instead of single color, provide screen shots for like when maxWeight is 100 and 900.

Thanks.

1chandu avatar Sep 25 '19 20:09 1chandu

Switching to [email protected] has no impact on any browser on windows. The bug is still present.

demo 1 console output:

util.js:329 This page appears to be missing CSS declarations for Mapbox GL JS, which may cause the map to display incorrectly. Please ensure your page includes mapbox-gl.css, as described in https://www.mapbox.com/mapbox-gl-js/api/.
w @ util.js:329
r._detectMissingCSS @ map.js:1500
r._setupContainer @ map.js:1513
r @ map.js:358
_create @ dist.min.js:6
_initialize @ dist.min.js:6
l @ dist.min.js:6
o @ dist.min.js:11
(anonymous) @ pen.js:2
pen.js:36 maxWeight: 0,0,0,0
pen.js:36 maxWeight: 0,0,0,0
pen.js:36 maxWeight: 0,0,0,0

demo 2:

codepen io_1chandu1_pen_BaBbGxQ (1) codepen io_1chandu1_pen_BaBbGxQ

It would seem that your custom heatmap layer fixes/bypasses the issue. Awesome work!

SterlingMcCall avatar Sep 25 '19 21:09 SterlingMcCall

@SterlingMcCall , thanks for the details, this isolates the issue domain calculation, digging into it ...

1chandu avatar Sep 25 '19 21:09 1chandu