たとえば、world spaceのnormalパスがあるとして、これをcamera spaceのnormalパスに変換したい場合、world spaceのnormalにカメラの回転マトリクスの逆行列をかければいい。

CameraMatrix allow us to multiply a "matrix" by the value of rgb.
For example, here is kinda normal pass which was rendered in CG as normal in world space, and then we will convert it to one in camera space. How? We can do this with multiplication the value of rgb of normal in world space and the inverse matrix which is "rotation matrix" of camera.

また、カメラの回転マトリクスは、カメラのスケールが(1,1,1)であれば、"Camera"ノードのworld matrixの((0,1,2),  (4,5,6), (8,9,10)) として得ることができる。

Well, when scale of Camera node is (1, 1, 1), you can handle as the world matrix of Camera node as the "rotation matrix" of camera. Actually it should be in m[0], m[1], m[2], m[4], m[5], m[6], m[8], m[9] and m[10].


And then, put them in ColorMatrix node. Because we use it as inverse matrix, just check "inverse" box.

その後、このColorMatrixノードをworld spaceのnormalパスにつなげると

After that, we connect the input of this ColorMatrix to the Read node which has normal pass in world space......

normal pass(world space) > normal pass(camera space) の変換ができる。
逆に、camera space を world space に変えたい場合は、inverseのチェックをはずせばいい。

And We can get the normal pass in camera space!
In case that camera space one would be converted to world space one, we don't need to check "inverse" box.

この方法で、normal pass の回転も可能です。

You can rotate your normal pass in this way.

No comments:

Post a Comment