papagina / HairNet_DataSetGeneration

The programs for generating the 40k hair dataset in HairNet: Single-View Hair Reconstruction using Convolutional Neural Networks https://arxiv.org/abs/1806.07467
Other
130 stars 34 forks source link

Question: Why apply "color[0] = x / 2.0 + 0.5;" at line #210 in the Renderer.h file? #4

Closed ANYMS-A closed 4 years ago

ANYMS-A commented 4 years ago

Hi, thank you for providing us such a convenient tools for generating 2D hair tangent orientation fields.

However, when I look up the source code in the Renderer.h file, I find that you applied a "color[0] = x / 2.0 + 0.5;" operation at line #210. Could you please tell me the reason why?

I can infer that after doing "x = x/norm" and "y = y/norm", we got the sin and cos values of the orientation angle. And those two values could help us to compute the tangent value of the angle.

papagina commented 4 years ago

That's for visualizing the orientations in png file.

ANYMS-A commented 4 years ago

That's for visualizing the orientations in png file.

Thanks for your reply! But I'm still confused, you mean if x < 0, then you map it by x= x / 2.0 + 0.5 to force x > 0? If so,x / y won't be the exact tangent value anymore.

e.g. if“ x = / norm = -1/2, y = y / norm = sqrt(3) / 2”, the tangent value is “x / y = -1 * sqrt(3) / 3” now. After you applying" x = x / 2.0 + 0.5", x will be 0.25, y is still "sqrt(3) / 2" , and the tangent value is “x / y = sqrt(3) / 8”