v2f vert(appdata_t IN) {
v2f OUT;
OUT.texcoord = IN.texcoord;
OUT.color = IN.color;
float sX = _ScaleX;
float sY = _ScaleY;
float scaleX = sX * OUT.texcoord.y + 1.0;
float4x4 transformMatrix = float4x4 (
scaleX,0,0,0,
0,sY,0,0,
0,0,1,0,
0,0,0,1
);
float4 skewedVertex = mul(transformMatrix, IN.vertex);
OUT.vertex = UnityObjectToClipPos(skewedVertex);
#ifdef PIXELSNAP_ON
OUT.vertex = UnityPixelSnap (OUT.vertex);
#endif
return OUT;
}
v2f vert(appdata_t IN) {
v2f OUT;
OUT.texcoord = IN.texcoord;
OUT.color = IN.color;
float sX = _ScaleX;
float sY = _ScaleY;
float scaleX = sX * OUT.texcoord.y + 1.0;
float4x4 transformMatrix = float4x4 (
scaleX,0,0,0,
0,sY,0,0,
0,0,1,0,
0,0,0,1
);
float4 skewedVertex = mul(transformMatrix, IN.vertex);
OUT.vertex = UnityObjectToClipPos(skewedVertex);
#ifdef PIXELSNAP_ON
OUT.vertex = UnityPixelSnap (OUT.vertex);
#endif
return OUT;
How could one go about solving thisThanks to makea reply from DMGregory the shape proper?problem likely arises from applying a non-affine transformation. In order to remedy this, one could use projective coordinates. What I am quite newreasonably certain I've done is add an extra dimension to working with shaders so the problem mightinput texcoord. This doesn't change anything when I scale everything with a set constant (like 2.0 in this case, picked very arbitrarily) as one would expect, since we would just be entirely on my end theremultiplying and dividing by the same value, but how does one go from this to proper projected coordinates described in the answer to another question, also by DMGregory.
v2f vert(appdata_t IN) {
v2f OUT;
OUT.texcoord = float3(IN.texcoord.xy * 2.0, 2.0);
OUT.color = IN.color;
float sX = _ScaleX;
float sY = _ScaleY;
float scaleX = sX * OUT.texcoord.y/2.0 + 1.0;
float4x4 transformMatrix = float4x4 (
scaleX,0,0,0,
0,sY,0,0,
0,0,1,0,
0,0,0,1
);
float4 skewedVertex = mul(transformMatrix, IN.vertex);
OUT.vertex = UnityObjectToClipPos(skewedVertex);
#ifdef PIXELSNAP_ON
OUT.vertex = UnityPixelSnap (OUT.vertex);
#endif
return OUT;
}
fixed4 frag(v2f IN) : SV_Target {
float2 uv = IN.texcoord.xy / IN.texcoord.z;
fixed4 c = tex2D(_MainTex, uv) * IN.color;
c.rgb *= c.a;
return c;
}


