Texture rotation

Your feedback is very important to us. We are listening.

Texture rotation

Postby mdaday » Tue Oct 10, 2017 12:23 am

Hi,

I am a new Amplify Shader Editor user. I am trying to use the rotator node but I don't want it to animate at all and I want to use it to rotate a texture to an arbitrary value. Is this possible?

Thanks
mdaday
mdaday
 
Posts: 1
Joined: Tue Oct 10, 2017 12:19 am

Re: Texture rotation

Postby Amplify_Borba » Tue Oct 10, 2017 8:51 am

Hello,

Welcome to our community and thank you for your support, it means alot to us!

It is possible to rotate a texture to an arbitrary value true the rotator node, since if a connection is made on the Time input port then it will assume that value as the final one and do not use any kind of timer internally.

So, in order to rotate the texture without animating it, you need to connect a Float through a Radians node to the Rotator's time input, and then use the Float node to set the angle of rotation.

I'm attaching an example of this node configuration for your convenience.

Rotate.jpg
Rotate.jpg (174.72 KiB) Viewed 12523 times


Please let me know if this was helpful, and if you have any further questions don't hesitate to get back in touch, thanks!
Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
User avatar
Amplify_Borba
 
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am

Re: Texture rotation

Postby BDub » Tue Jan 30, 2018 9:28 am

Thanks for the tip! I am trying to rotate a texture but at the same time keeping the tiling/offset because it is used as a grid for a plane. Is there a way to do this? The rotator passes in a UV and according to the documentation for Texture Sample, this overrides the texture tiling and offset parameters. :?:
BDub
 
Posts: 4
Joined: Tue Jan 30, 2018 9:15 am

Re: Texture rotation

Postby Amplify_Borba » Tue Jan 30, 2018 10:23 am

BDub wrote:Thanks for the tip! I am trying to rotate a texture but at the same time keeping the tiling/offset because it is used as a grid for a plane. Is there a way to do this? The rotator passes in a UV and according to the documentation for Texture Sample, this overrides the texture tiling and offset parameters. :?:


Hello BDub, thank you for getting in touch!

Although the Texture Sample node's UV input overrides the texture tiling and offset parameters, you may still set your intended values in the Texture Coordinates node's Tilling and Offset inputs, otherwise they'll simply pass the default values of (1,1) Tiling and (0,0) Offset to the texture, as the Rotator node will simply rotate the UV taking into account the Tiling and Offset parameters it receives. The following screenshot exemplifies a node setup similar to the previous one, but passing custom Tiling and Offset values to the Rotator node.

TCN.jpg
TCN.jpg (105.19 KiB) Viewed 12294 times


Please let me know if this helps, thanks!
Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
User avatar
Amplify_Borba
 
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am

Re: Texture rotation

Postby BDub » Tue Jan 30, 2018 11:35 am

That worked brilliantly!! Thanks for the quick reply (and the awesome asset!). :D
BDub
 
Posts: 4
Joined: Tue Jan 30, 2018 9:15 am

Re: Texture rotation

Postby Amplify_Borba » Tue Jan 30, 2018 11:51 am

BDub wrote:That worked brilliantly!! Thanks for the quick reply (and the awesome asset!). :D


Glad we could be of assistance, thank you for your support and kind words!

Please don't hesitate to get back in touch if you have any further questions, thanks!
Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
User avatar
Amplify_Borba
 
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am

Re: Texture rotation

Postby BDub » Tue Jan 30, 2018 1:46 pm

Just a quick note for anyone trying this. Adding tiling affects Anchor of Rotator so the anchor should be adjusted accordingly (ex. 0.5*tiling.x, 0.5*tiling.y, 0f, 0f). If you are using offsets, add offset to the anchor as well.

Example:
Code: Select all
Vector4 newRotatorAnchor = new Vector4(
   newTextureScale.x/2 + newTextureOffset.x,
   newTextureScale.y/2 + newTextureOffset.y,
   0f,
   0f
);
mat.SetVector("_RotatorAnchor", newRotatorAnchor);   
Last edited by BDub on Tue Jan 30, 2018 3:25 pm, edited 1 time in total.
BDub
 
Posts: 4
Joined: Tue Jan 30, 2018 9:15 am

Re: Texture rotation

Postby BDub » Tue Jan 30, 2018 2:13 pm

oh and also add offset to anchor if you are using offset ;)

edit: added code example in my last post above.
Last edited by BDub on Tue Jan 30, 2018 3:26 pm, edited 1 time in total.
BDub
 
Posts: 4
Joined: Tue Jan 30, 2018 9:15 am

Re: Texture rotation

Postby Amplify_Borba » Tue Jan 30, 2018 3:08 pm

Good point, apologies for not mentioning that in my reply.

Thank you for taking the time to share this information with the community!
Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
User avatar
Amplify_Borba
 
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am


Return to General Discussion

Who is online

Users browsing this forum: Bing [Bot] and 6 guests