1
\$\begingroup\$

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?

\$\endgroup\$
0

1 Answer 1

2
\$\begingroup\$

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.

\$\endgroup\$

You must log in to answer this question.

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