rufaswan / Web2D_Games

2D Games playable on the web!
https://rufaswan.github.io/Web2D_Games/
GNU General Public License v3.0
27 stars 6 forks source link

Issues with Precision in Handling Quad Images in Photoshop #17

Open bbsuuo opened 7 months ago

bbsuuo commented 7 months ago

Hello rufaswan,

I have been developing a Photoshop plugin that segments quads and automatically creates individual layers for each frame, as part of utilizing your Web2D_Games project. However, I've encountered some issues regarding image precision.

In my plugin, I've noticed that Photoshop seems to handle image unit movements using only integer pixel units, which conflicts with the floating-point type data in the quad format. This integer pixel limitation leads to some discrepancies when transforming images.

To mitigate this, I've currently implemented a method that rounds up all pixel values. While this approach works well for image segmentation, it is less than ideal when collecting frame data and performing transformations.

I am exploring solutions to enhance the precision of data handling. Do you have any suggestions or potential solutions for dealing with such precision issues? I aim to improve this aspect and plan to commit my code to a new repository once the issue is resolved.

Looking forward to your response, and thank you very much for your time and assistance!

qa3

qa2

rufaswan commented 7 months ago

Yeah. I have been thinking about these kind of problem too. I don't have an exact answer, one possible reason I think the original source images are much higher resolution. Even PS4 4K HD is just a down-scaled, low-quality (lossy compression) than source images.

Also, I'm a programmer, not an artist. I have no idea what program they used to draw the sprites with. It could be vector image as source, but then export as raster images for distribution.

Then if you consider it is 3D rendering engine, and 3D models will have a lot of jagged / sharp edges after rendering. So they often use anti-alias or filters to smooth them out. Therefore, the rendered sprites are not pixel-perfect. It is not meant for pixel art to begin with.

https://blog.codinghorror.com/fast-approximate-anti-aliasing-fxaa/

Then again, we have Gunvolt that seems to be using 3D rendering engine and is somehow is pixel-perfect. I have no idea how they do it.

TLDR I don't know. Sorry. ¯\(ツ)