Rotation of image_maps??

  • I recall having seen, at some point in a far history, an example how to perform texture map rotation in the material room.
    The method contained the elementary rotation matrix of course, fed into the u-offset and v-offset channels, but as I learned today also something more.
    Did anyone of you ever explore this?

  • @F_Verbaas Not seeing any replies here, so I'll offer what I've learned from invaluable explanations and clarifications by bagginsbill.

    0_1477568601867_Screen Shot 2016-10-27 at 10.42.46 pm.png
    The image shows the content of a collapsed shader node doing the simple matrix calculation for UV rotation by an angle Theta about an alternative origin (0.5, 0.5). Theta, in this example 57 degrees is converted to radians ( times pi over 180 ) as required for inputs to the sine and cosine math functions. The standard multiplication matrix has the effect of an anti-clockwise rotation about the origin (0, 0), so we subtract the required origin (0.5, 0.5) from the U and V coordinates before the rotation, then add the origin back in again after the rotation.

    The magic BB incantation is the revelation that whatever you plug into the U_Offset and V_Offset inputs of a texture map node will be subtracted from U and V respectively, so that with nothing plugged into those inputs, U and V will be used to map the image onto the object by default. Plugging scalars into the U and V offset will just offset the image. (U minus offset and V minus offset).

    0_1477568867755_Screen Shot 2016-10-27 at 10.41.02 pm.png
    The above image shows how the desired UV matrix rotation is applied to account for the internal magic happening on the UV inputs of the Texture Map Node.

    U_Offset = ( internal_U minus ( U minus Rot_U ) ) = ( internal_U minus U ) plus ( minus minus ) Rot_U

    and the equivalent for V_Offset.

    The matrix math is simpler if you don't need the rotation origin to be different from the default (0, 0), which is the bottom, left-hand corner.

  • @anomalaus

    What are those nodes names "u_Texture_Coordinate" and "u_Texture_Coordinate"?
    I thought to "TextureCoordinate" in the "Cycles" part but on my system, this box doesn't collapse...

  • @Y-Phil those are "Firefly" nodes, if you like to think of them that way, rather than native Cycles nodes, but they still have the expected effect when used in Superfly renders which reference the standard Poser image_map nodes. From all I've read, you can still mix and match (with certain limitations) pure Cycles and Poser shader nodes. I assume that is the thrust of your question. The image below is how to get the u_Texture_Coordinate node from the hierarchy popup. The one below u, (v) gives the v_Texture_Coordinate node

    0_1477575171201_Screen Shot 2016-10-28 at 12.02.49 am.png
    If you are looking for a way to do this in a purely Cycles manner, I have no direct experience, but a quick inspection of the Cycles ImageTexture node shows a vector input, to which, I imagine, you can attach Mapping and TextureCoordinate nodes as shown below. I'm sure there will be Blender tech sites with better reference material for this (that's how I determined what to plug into the Mapping Vector input to drive the rotation. In the time I was composing this answer, I determined that the Rotation vector units seem to be radians and the third element of the Rotation vector value (X, Y, Z) Z is where to plug in a rotation for the UV mapping, but I couldn't work out how Location could be used to rotate around a centre other than the bottom, left corner as with the Poser nodes UV example.

    0_1477575139892_Screen Shot 2016-10-28 at 12.27.35 am.png

  • @anomalaus

    That's awesome as is, I don't need to be 100% Cycles, as your compound node works perfectly:

    alt text

    Thank you!

  • anomalaus, would it be possible for you to post an .mt5 of the shader somewhere, as trying to make that tree myself would probably make my brain explode. :)

  • @rlowens68 said in Rotation of image_maps??:

    anomalaus, would it be possible for you to post an .mt5 of the shader somewhere, as trying to make that tree myself would probably make my brain explode. :)

    Here you are:
    The only difference is that I've integrated into the compound node the two nodes "U_Minus_Rot_U" and "V_Minus_Rot_V" so that the compound node has 6 outputs and 3 inputs

  • Thank you very much :)

  • @rlowens68 said in Rotation of image_maps??:

    Thank you very much :)

    Most welcome :-)

  • Poser Ambassadors

    This is a simple way to rotate a texture. here done on a tile setup.

    The 0.5 value in U_Offset and V_Offset mean that the texture will be rotated 45°

    I think this is what you recalled from memory.
    Best regards, Tony

  • @anomalaus
    Thank You!!
    This was exactly what I was looking for.
    And yes, I think the compound nodes are made exactly for purposes like this one.
    And good to see the Cycles nodes give something more sophisticated.
    That is a nifty shotcut for + or - 45 degrees. where the sine equals the cosine.
    Very clever.

  • @Y-Phil Thanks for the quick response for others, my poser system is currently locked in a multi-hour (multi-day) render. X-(

    @vilters The shortcuts for 45 and 90 degree rotations are very useful with tiling, but apart from the cardinal (90 degree multiples) rotations, the simple versions have inherent scaling, unless you pre-calculate the correct factors, for instance, the example shown has tile width and height of 0.1, so 10 tiles across U and V without rotation. The example shows 10 tiles across the diagonal, so the tiles are sqrt(2) or 1.4142 times bigger, so you'd need to plug 0.07071 into the width and height to get an unscaled rotation.