Rotating an object with vector displacement

Short question: How can I rotate an object in the shader editor, using vector displacement or other means?

Longer explanation: I have an object which I have instanced many times, each instance has a Track To constraint so each object is pointing to another object - in fact there are three groups of instances, and instances of instances, with three different Track To objects. So far, so good. My problem is that each instanced object now has the same local z rotation, that of the original object, though the local x and y rotations are different in each case, due to the Track To constraints. I would like random z rotations on each instanced object. I cannot z rotate each instance because of the constraints. (Maybe a different constraint would allow this?)
I feel this must be possible using vector displacement, as I know that rotating an object to face the camera is possible with vector displacement, but I have no idea how to do it in this scenario.
If it helps to visualise, the instanced objects are spoke nipples attached to the inner rim of a bicycle wheel. Because of the spoke pattern and position around the wheel, each nipple requires a unique rotation. I want each nipple to be randomly rotated around its z axis, so that they are not all perpendicular to the wheel face as they are at the moment.

Any help would be gratefully received.

Just an answer to your short question:

You can rotate an Object in the shader using the object coordinates: Transform them to your liking and then feed the difference to the original coordinates into a Vector Displacement node set to object space.
(Just make sure you have displacement enabled in the material options)

Edit: Just read your longer question. If I’m understanding your problem right, it should be just a matter of using the Random output in the Object Info node to drive the Z-rotation of the Mapping node in the setup above.

Thanks for that, though I have tried that method, and I can’t get it to work as intended. Even with no rotation applied, it still leads to shading errors, and at larger, but not extreme rotation values, it distorts the mesh entirely.
Maybe I am doing something wrong here?
Shading before:

Shading after connection, but with no rotation:

With rotation applied, you can see the top view of the mesh for comparison:


Yes, the viewport is rotated slightly here, the distorted object may be hard to see, it’s the metallic flat smudge in the centre of the rendered view.

Try using the Vector Math node to calculate the difference. I hope that fixes it.

You’re using a Math node. It only outputs numbers, which is why it gives you shading errors even without applying any rotation.

You are right! How could I have missed that? I feel like a… like a… an Autodesk user!
The node setup you provided does indeed rotate the object without distorting the mesh, so I have marked your original answer as correct.
There are still some shading errors, however, and even without applying a rotation. I cannot fully explain them. They can be reduced by adding support loops, but are still present. I had used two weighted normal modifiers before the vector displacement, but the modifiers seem to have no effect when used with the vector displacement.

Regular smoothed normals:

Regular smoothed normals with vector displacement connected but no rotation applied: notice the small shading differences around the edges, particularly in the red circle.

Weighted normals:

Weighted normals with vector displacement connected but no rotation applied:

Any ideas how I can keep my weighted normals and apply rotation through vector displacement?

Hmmm, I hardly use weighted normals, so I never ran into this issue.

I played around a bit with the setup, but unfortunately had no luck fixing it from within the material and a quick google search didn’t return any obviously useful results either.