I am new to working with shaders and I am having issues with my vertex shader. When I transform the object in any way (position, rotation, scale) the effects are exaggerated and I do not know why this is the case. The goal of the shader is to create the illusion of a tilting platform to roll a ball. The following is my vertex shader:
void vert(inout appdata_full v, out Input o){
float3 worldPos = mul(unity_ObjectToWorld, float4(v.vertex.xyz, 1)).xyz - _RotatePosition.xyz;
float3x3 xRot =
{
1.0, 0.0, 0.0,
0.0, cos(_Rotation.x), -sin(_Rotation.x),
0.0, sin(_Rotation.x), cos(_Rotation.x)
};
float3x3 yRot =
{
cos(_Rotation.y), 0.0, sin(_Rotation.y),
0.0, 1.0, 0.0,
-sin(_Rotation.y), 0.0, cos(_Rotation.y)
};
float3x3 zRot =
{
cos(_Rotation.z), -sin(_Rotation.z), 0.0,
sin(_Rotation.z), cos(_Rotation.z), 0.0,
0.0, 0.0, 1.0
};
v.vertex.xyz = mul(zRot, mul(yRot, mul(xRot, worldPos.xyz))) + _RotatePosition.xyz;
UNITY_INITIALIZE_OUTPUT(Input, o);
}
I would really appreciate any help explaining the issue.