W3C home > Mailing lists > Public > public-fxtf-archive@w3.org > January 2018

Re: [fxtf-drafts] [filter-effects] Require image re-sampling for feDisplacement

From: Amelia Bellamy-Royds via GitHub <sysbot+gh@w3.org>
Date: Tue, 02 Jan 2018 21:29:58 +0000
To: public-fxtf-archive@w3.org
Message-ID: <issue_comment.created-354880152-1514928597-sysbot+gh@w3.org>
> I'd like to get more concrete into your proposal. Lets say you have a 1000x1000 dot input source and a 1000x1000 dot displacement map. How would the image-rendering behave? Scale both up (oversampling) or down dependent on the value of the property? Leave the actual scale level to the implementation? What indication or suggestion would we give implementations? What is the desire of pixelated? To get to 60fps animations?

You wouldn't scale either image as a whole. You would sample individual pixels.  If a black pixel at (0,0) and a white pixel at (0,1) end up displaced such that they are three extra pixels in between them with no directly matching pixel from the source image, it's a question of how do you draw those in-between pixels? Do you alias them to be either black or white? Or do you shade them in gray, according to the distance between the black pixel and the white one?

In other words, for a input image like this (4x1, alternating white and black pixels):

```
 ▓ ▓
```

That gets displaced by a gradient, to create the following map of X-displacements:

```
0369
```

In other words: the first (white) pixel at (0,0) stays where it is. The second (black) pixel at (1,0) gets shifted 3 pixels right, so that it is at (3,0). All the other pixels get displaced out of the 4x1 bounds.

The question is: How do you color the result pixels at (1,0) and (2,0)?

Should the outcome look like this, each missing pixel aliased to match its nearest neighbour?

```
  ▓▓
```

Or like this, with the colors of the missing pixels interpolated as a weighted average of their nearest neighbours?

```
 ░▒▓
```

For the `image-rendering` values, I would expect:

- `auto`: Let the browser choose aliasing or interpolation.
- `crisp-edges` and `pixelated`: Alias all pixels in the result image to exactly match the color of a pixel from the input image (using the nearest displaced pixel).
- `smooth` and `high-quality`: Use distance-weighting to interpolate the values of result pixels from their neighbours.

-- 
GitHub Notification of comment by AmeliaBR
Please view or discuss this issue at https://github.com/w3c/fxtf-drafts/issues/21#issuecomment-354880152 using your GitHub account
Received on Tuesday, 2 January 2018 21:30:01 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:50:21 UTC