How to rotate UV projection with matrix

How to rotate UV projection with matrix

MarkWallman_
Explorer Explorer
934 Views
3 Replies
Message 1 of 4

How to rotate UV projection with matrix

MarkWallman_
Explorer
Explorer

Hi, I am trying to project an image taken from a chrome ball onto geo to turn it into a mesh light. I have read the docs but do not understand how to rotate the ball by degrees in the projection of X, Y and Z to line the image up with the geo Which values are which in the matrix shown in the docs? https://docs.arnoldrenderer.com/display/A5AFHUG/UV+Projection Any help would be great.

0 Likes
935 Views
3 Replies
Replies (3)
Message 2 of 4

madsd
Advisor
Advisor

The Arnold and OSL matrix is a 4x4 matrix.

You read it like a book, from left to right.
You can interpritate it as 4 vec4 structs.

RGBA
RGBA
RGBA
RGBA

Although they are infact just floats all together sitting on a string.

If you read downwards its
X
Y
Z
W

So typical rotation would look something like...

matrix ( cos(a), sin(a), 0, 0,

-sin(a), cos(a), 0 ,0,

0,0,0,0,

0,0,0,0);

So you just fill in the 2 first slots in the first to lines so to speak.

And you use the 2 math nodes cos and sin for the float value you are going to use as the driver for spinning it around on the U and V space. Dont forget to add a negative node for the second sin function.

With cos and sin you level out the fact that we sample a point on a circle which has exponential factors attached to it as we get closer to either 0 or 1 on both axis. And so the result will then be that if you pipe a linear increasing float value through "a" the rotation will be steady and linear.
Now you can spin it around any axis you want.

0 Likes
Message 3 of 4

MarkWallman_
Explorer
Explorer

Hi. Thanks for that. Crickey, the Maya equivilant is just a 3d texture I can translate and rotate in the 3d viewport to line it up. I will give it a go but i suspect it is not going to be very easy to line it up in htoa. It feels this workflow needs to be simplified. Have a good one. Best mark

0 Likes
Message 4 of 4

apps88EMR
Contributor
Contributor

Just ran into this, so noting it incase anyone else runs into it. You can connect a matrix transform node to a UVproject node in Houdini and it will give you standard transform controls for your projections. 

0 Likes