I’m doing a raytracing exercise. I have a vector representing the normal of a surface at an intersection point, and a vector of the ray to the surface. How can I determine what the reflection will be?

In the below image, I have

`d`

and`n`

. How can I get`r`

?Thanks.

**Answer**

r=d−2(d⋅n)n

where d⋅n is the dot product, and

n must be normalized.

**Attribution***Source : Link , Question Author : Nick Heiner , Answer Author : Phrogz*