Very cool, thanks for including the code to learn from also!
Printable View
Very cool, thanks for including the code to learn from also!
Teriyaki, I think you were close. Rotations can be tricky...
I am not going to talk much about trigonometry, I am not a mathematician, but I think this problem can be understood without using very advanced maths.
It helped me a lot to think of a sphere of R=1.
With Pixolpick you get the x,y,z components of a vector that you can imagine as the radius of the unit sphere in that particular orientation. That vector can also be defined by two angles, T and P.
Let's say T is the vertical angle, this angle is defined by the value of the y component of your unit vector so T=ACOS(Uy).
Then the P angle depends of the values in the X and Z axis. P=ATAN2(Ux,Uz) ... atan2 takes care of all the different cases like when Uz is equal to 0, so we don't have to worry about it...
These two angles can also be called spherical coordinates and rotating the camera by those angles should do the trick.
Now we have to convert the angles to the equivalent distance (in pixels) to simulate a drag click that moves our camera the exact amount.
For the vertical rotation I found 1 degree is equal to 2.777777 pixels while the horizontal rotation 1 degree is equal to 1.111111 . This means we need to move our pen more pixels to rotate vertically, that's actually a very cool idea from the pixo guys because very often we just want to rotate our models horizontally to get a good 3D feeling (at least this is why I think they didn't use the same number)
This method should obviously have a rounding error because pixels are integers but I think it's not very noticeable
Thanks for the explanations - I will work to understand this :)
I am looking for the same function. Thank you for the CamControl plugin. It works almost perfectly. But as you mentioned, it is not exactly normal, causing irregular surfaces when a surface is repositioned and using the Trim-Front brush for example.
Do you know if an exact AlignCameraTosurfaceNormal feature has been added to zbrush2018? Or have another suggestion?
Thank you