I want to know how the world reflection vector in shaders is calculated so that I can manipulate it, but there is no documentation on what it does or how Unity calculates it. How is the reflection vector calculated and exactly what does it do?


1 Answer 1


The reflection vector is calculated as below:

float3 refl = 2.0 * o.Normal * dot(o.Normal, IN.viewDir) - IN.viewDir;
//float3 refl = IN.worldRefl;

That equation is similar to specular reflection.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .