Given the result of a dot product and one of the vectors, is it possible to find the other vector?

80 Views Asked by At

When processing geometry the dot product or $n\cdot L$ (where $n$ is the normal, $L$ is the light direction) is baked into the $w$ of a vertex, but since the $L$ is constant I wanted to know if there is any way to get $n$ without changing the backend processing?

3

There are 3 best solutions below

1
On BEST ANSWER

No, not even in the two dimensional case. In the 2-D case, however, you can narrow it down to one of two directions which are obtained from a quadratic equation:

$$ \vec{n}\cdot \vec{L} = n_x L_x + n_yL_y = k \implies n_y = \frac{k-n_xL_x}{L_y} \\n_x^2 + n_y^2 = 1\implies n_x^2 + \left( \frac{k-n_xL_x}{L_y} \right)^2 = 1 $$ which is a quadratic equation giving two possible solutions of $n_x$.

In the 3-D case a whole circle of answers is possible.

6
On

You can't recover n from n.L and L:

Suppose v is any vector perpendicular to L, so that v.L $=0$. Then (n+v).L = n.L + v.L = n.L. So any such n+v also satisfies your condition on n.

0
On

Given a vector $\vec v$ and scalar $a$, there is no unique solution to the equation $$\vec v\cdot\vec w=a.$$

Consider the case $\vec v=\vec k$, and $a=0$. Then any vector of the form $x\vec i+y\vec j$ is a solution to $$\vec v\cdot \vec w=0.$$