Have Sprite Material rotate only on one axis

I’m having trouble understanding the Sprite function

Basically I want to have the sprite rotate only around the Z axis to always face the camera, but I haven’t been able to wrap my head around the math.

I also would like to implement a way for the Z rotation to vary slightly for each instance. For this I can use PerInstanceRandom, but I can’t figure out where to vary this specific rotation

Found a solution using a node tree provided in this tutorial Stylized Rendering Materials | Unreal Engine Documentation
Here is the asset
M_Grass_Masked.uasset (111.3 KB)

To handle random instance rotation I added this part to the node tree