How to get a reflection vector?

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?

Vector d is the ray; n is the normal; t is the refraction; r is the reflection




where dn is the dot product, and
n must be normalized.

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

Leave a Comment