# Filter id="displacement-filter"
**[filterUnits](https://www.w3.org/TR/filter-effects-1/#element-attrdef-filter-filterunits)** = "*userSpaceOnUse* | *objectBoundingBox*"
**[color-interpolation-filters](https://www.w3.org/TR/filter-effects-1/#propdef-color-interpolation-filters)** = [auto](https://www.w3.org/TR/filter-effects-1/#valdef-color-interpolation-filters-auto) | [sRGB](https://www.w3.org/TR/filter-effects-1/#valdef-color-interpolation-filters-srgb) | [linearRGB](https://www.w3.org/TR/filter-effects-1/#valdef-color-interpolation-filters-linearrgb)
**[feImage](https://www.w3.org/TR/filter-effects-1/#elementdef-feimage)** The filter image(s) to use.
**[feDisplacementMap](https://www.w3.org/TR/filter-effects-1/#elementdef-fedisplacementmap)** How the filter is applied.
>***scale***: is the strength of the distortion.
***xChannelSelector*** & ***yChannelSelector***: determines which color channels (red, green, blue, alpha) should be applied to which axis for distortion.
***[in](https://www.w3.org/TR/filter-effects-1/#element-attrdef-filter-primitive-in)*** = [SourceGraphic](https://www.w3.org/TR/filter-effects-1/#attr-valuedef-in-sourcegraphic) | [SourceAlpha](https://www.w3.org/TR/filter-effects-1/#attr-valuedef-in-sourcealpha) | [BackgroundImage](https://www.w3.org/TR/filter-effects-1/#attr-valuedef-in-backgroundimage) | [BackgroundAlpha](https://www.w3.org/TR/filter-effects-1/#attr-valuedef-in-backgroundalpha) | [FillPaint](https://www.w3.org/TR/filter-effects-1/#attr-valuedef-in-fillpaint) | [StrokePaint](https://www.w3.org/TR/filter-effects-1/#attr-valuedef-in-strokepaint) | [<filter-primitive-reference>](https://www.w3.org/TR/filter-effects-1/#typedef-result-filter-primitive-reference)
```svg
<filter id="displacement-filter" width="228" height="228" x="580" y="0" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feImage width="228" height="228" href="https://assets.codepen.io/100347/fed_sagrada-384.jpg" />
<feDisplacementMap id="fedisplacementmap" in="SourceGraphic" xChannelSelector="R" yChannelSelector="B" scale="50" />
</filter>
```
https://drafts.fxtf.org/filter-effects/#elementdef-fedisplacementmap
This filter primitive uses the pixels values from the image from **in2** to spatially displace the image from **in**.
This is the transformation to be performed:
> P'(x,y) ← P( x + scale * (XC(x,y) - .5), y + scale * (YC(x,y) - .5))
The displacement map, **in2**, defines the inverse of the mapping performed.
To sum up the inner mechanics of the displacement filter are these three simple sentences:
Any color value above 127 will shift the corresponding pixel into the direction of the scale value;
Any color value below 127 will shift the corresponding pixel into the opposite direction;
A color value of 127 will have no effect.