Hello, I’m trying to do something in an HLSL Custom node but first need to figure out how to rotate a texture, so as a test I’ve tried copying over the CustomRotator node below.
Here’s the code I’ve created (same variable names as the comments in the nodes above)
//Inputs: Tex, UV, Center, Angle float2 angle1 = float2(sin(Angle), cos(Angle)); float2 angle2 = float2(cos(Angle), -sin(Angle)); float preDot = -Center + UV; float dot1 = dot(preDot, angle2); float dot2 = dot(preDot, angle1); float2 preRot = float2(dot1, dot2); float2 rot = Center + preRot; return Texture2DSample(Tex, TexSampler, rot);
The code seems to be identical to the nodes above, however look at my HLSL rotation compared to the Nodes one:
I can’t see where my code went wrong from the nodes. Any ideas?