# need help to understand maths of parallax bump mapping

Hi,
I have a documentation and i don’t understand some points.
this is the link : http://www.infiscape.com/doc/parallax_mapping.pdf

can you help me please ?

page 3 in the text:To compute a texture coordinate offset at a point P, the eye vector must first be normalized
to produce a normalized eye vector V. The height h at the original texture coordinate To is
read from the height map. The height is scaled by a scale factor s and biased by a bias b in
order to map the height from the range {0.0, 1.0} to a range that better represents the
physical properties of the surface being simulated. For example, a brick wall texture might
cover a 2x2 meter area. Also imagine the surface of the bricks and the recessed grout give
the surface a thickness of 0.02m. The correct scale factor for this material would be 0.02 /
2 = 0.01. Coupling this with a bias of 0.0 would then remap the height field to a range of
{0.0, 0.01}. Using a bias of ­0.01
would remap the range to {­0.99,
0.0}. The average of
these two extremes is probably best for most textures.
b = s ∙ ­0.5

here : Coupling this with a bias of 0.0 would then remap the height field to a range of
{0.0, 0.01}.

1)how we get this new range ?

here : Using a bias of ­-0.01
would remap the range to {­-0.99,
0.0}. The average of
these two extremes is probably best for most textures.
b = s ∙ ­-0.5

2)why do we take -0.01
3)and how do we get the range {­-0.99,0.0} ?
4)how we obtain ­-0.5 in b = s ∙ ­-0.5 ?

here : An offset is then computed by tracing a vector parallel to the polygon from the point on the
surface directly above P to the eye vector. This new vector is the offset and can be added to
To(To : Texture Origin for the coordinates) to produce the new texture coordinate Tn.
Tn = To + ( hsb ∙ V{x, y} / V{z} )

5)why do we divide V(x, y) by the z component ?

Coupling this with a bias of 0.0 would then remap the height field to a range of
{0.0, 0.01}. Using a bias of ­0.01
would remap the range to {­0.99,
0.0}. The average of
these two extremes is probably best for most textures.
b = s ∙ ­0.5

You left out some negative signs above, which might cause you some confusion. Have another look at that part of the paper.

here : Coupling this with a bias of 0.0 would then remap the height field to a range of
{0.0, 0.01}.

1)how we get this new range ?

here : Using a bias of ­-0.01
would remap the range to {­-0.99,
0.0}. The average of
these two extremes is probably best for most textures.
b = s ∙ ­-0.5

2)why do we take -0.01
3)and how do we get the range {­-0.99,0.0} ?

Scale is a multiply operation. Bias is an addition operation.
{0.0, 1.0} * 0.01 = {0.0, 0.01}
{0.0, 0.01} + -0.01 = {-0.99, 0.0}
0.01 and -0.01 are arbitrary. You can use whatever value looks best for the material that you are simulating.

4)how we obtain ­-0.5 in b = s ∙ ­-0.5 ?

b = s * -0.5
is a rule of thumb. It gives you a bias that is appopriate most of the time, but you can always use something different.

here : An offset is then computed by tracing a vector parallel to the polygon from the point on the
surface directly above P to the eye vector. This new vector is the offset and can be added to
To(To : Texture Origin for the coordinates) to produce the new texture coordinate Tn.
Tn = To + ( hsb ∙ V{x, y} / V{z} )

5)why do we divide V(x, y) by the z component ?
Read section 4.3. No more z component, and we get better visual results.

thanks for your answer ! (i didn’t come here for several days)
but i don’t understand something :
{0.0, 0.01} + -0.01 = {-0.99, 0.0}

0.0 -0.01 = -0.01 so why -0.99 ?

I must be blind. You’re absolutely right. I’ll correct that in the paper later today.