Question about displace(ex9)

i am looking to understand the code in displace(ex9)

i see that the pixels get pushed

  • at angle given by a normalmap (red,green)
  • at a distance given by Amount

can someone put the formula into words ?

tex2D is texture
s0 is sampler
normally it’s gonna look like tex2d(s0,uv coordinates)
uv gives a point in witch we gonna get float4 color from texture
so we will have uv coordinate “lerp(x,tex2D(s1,x2).xy,Amount” in your case
this says i got original uv coordinate “x” i want to blend it with values from “tex2D(s1,x2).xy” by the Amount.

basically this should distort texture by the red and green color of texture itself, i’m not sure there are something about normal’s here.
look where x2 is coming from… might give you more clue