I'm making a pixel-art game in Unity. The sprites are set to 16 PPU, and currently to guarantee that the pixels scale nicely (integer intervals), I'm setting the Camera's orthographic size.
In 16x9 aspect ratio on a 1920x1080p monitor, this gives me an orthographic size of 8.4375, effectively scaling up my art 4x.
The problem comes with rotations. When you rotate the pixel art using a standard rotation shader, the shader considers screen pixels but not the art pixels. I know there are solutions to this problem on the Asset store, but I'd like to create my own (I have checked other stack posts on this subject, but there doesn't seem to be a solution).
Currently, I have a rotation shader that rotates the vertices in the vertex function. However, like I mentioned above, this rotates in screen pixels. One idea I had was to first scale the sprite down to its art pixel dimensions (by scaling the vertices in the vertex shader), then rotate it, then scale it back up (in another pass?). I couldn't figure out how to make this work, and I'm not sure if it's the most efficient way.
Another idea I had was to create a copy of the texture that's being rotated in a script, save it in a larger texture, then handle all my rotations within the new texture (using
Apply). This would ensure that the rotations are being done in art pixels, but is probably slower (and more inconvenient) than using a shader.
Note: Rendering to a back buffer and then scaling up everything is not a solution for me (this isn't a purist pixel art game, I just want pure pixel art rotations).
Any ideas? What approach should I take? I don't need the code written out for me, I just need an approach that'll work. Thank you!
Here is an example of what I'm talking about (credit for images goes to this stack overflow post, although it didn't have the solution I'm looking for).
This is not a duplicate of this stack post. The solution that was accepted in that post does not perform rotation on the art pixel level, and because of that, it's not a valid solution in my case.