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

IconLayer renders icons at small sizeScales with significant loss of quality

Open srikanthnarayan opened this issue 9 years ago • 6 comments

I'm trying to render a small triangle pointing to the direction of travel on a map.

Here's the asset I'm currently using: direction-pointer-alt Dimension: 7 x 10

When rendered on a map, I see that there is significant loss of quality, along with significant distortion (tracked in issue 834). screenshot 2017-08-29 17 38 32

Here's how I'm instantiating the layer:

    new IconLayer({
      id: 'direction-pointer',
      data: arrows,
      fp64: true,
      getColor: (d, i) => {
        const opacity = d.index < currentIndex ? 255 : 0;
        return [0, 0, 0, opacity];
      },
      iconAtlas: assetUrl('/static/direction-pointer.png'),
      iconMapping:  {
        marker: {
          x: 0,
          y: 0,
          width: 7,
          height: 10,
          mask: true
        }
      },
      sizeScale: 10
    });

srikanthnarayan avatar Aug 30 '17 00:08 srikanthnarayan

@1chandu @ibgreen Could this be related to the power-of-two texture change in luma v4?

Pessimistress avatar Aug 30 '17 18:08 Pessimistress

Luma v4 uses WebGL2 by default, NPOT (non power-of-two textures) textures are supported and shouldn't cause any issue.

I will take a look at this issue, after I wrap my current tasks, should be in next couple of days.

1chandu avatar Aug 30 '17 18:08 1chandu

Need to re-test this with #834 fix (@rivulet-zhang working on it).

1chandu avatar Aug 30 '17 23:08 1chandu

@1chandu #900 handles the distortion caused by rotation. As a separate issue, the scaling of the icon seems to be inaccurate, which could relate to this issue. Say I am rendering an icon with getSize: d => s1 and sizeScale = s2, the resulting icon actually has a much smaller size as opposed to s1 * s2. This exists in the original version and #900 does not handle this for now. Let me know if you want me to look into this.

rivulet-zhang avatar Aug 31 '17 17:08 rivulet-zhang

@1chandu @ibgreen Could this be related to the power-of-two texture change in luma v4?

Kind of, I was more thinking that this could be related to a change in default texture filtering parameters. We need to make sure we are using the best texture filtering.

ibgreen avatar Aug 31 '17 21:08 ibgreen

Say I am rendering an icon with getSize: d => s1 and sizeScale = s2, the resulting icon actually has a much smaller size as opposed to s1 * s2. This exists in the original version and #900 does not handle this for now. Let me know if you want me to look into this.

@rivulet-zhang Yes it sounds like this is worth another look.

ibgreen avatar Aug 31 '17 21:08 ibgreen