New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pixel perfection, texel snapping #176
Comments
|
Yeah I'm not a big fan of snapping the objects themselves (that will create other issues), but doing it in a shader is an interesting approach. I don't think I'd make it the default, but having pixel-snapping shaders as an option in Futile would be handy. |
|
On the other hand, I thought that eliminating subpixel positioning by snapping vertices to points may not be a bad idea after all. It will also allow people to use their own shaders without integrating them with pixel snap algorithm. I will try that as well, it's an easy patch after all. |
|
Yup, you could go into the FRenderLayers and manually round the position of each vertex. I think that'd work but it'd introduce a sizeable processing overhead if you were doing it every frame. |
|
I don't think a call to a single native method will cause any significant overhead, I even think that it will be a tiny nice optimization (don't update vertices if they round up to the old values). I haven't digged into the renderer code yet, but I'm pretty sure it's not reuploading vertices unless they are changed, so it'd be just a bonus condition. |
While this is correct, it is not a solution. Subpixel movement will still get artifacts most of the time, on both OpenGL and DirectX. This could be resolved two ways: the less elegant is to snap every object's position to points (e.g., round() for OGL, round() + 0.5 for DX; the more elegant one is to snap inside the shader, and in fact, a shader like this is already a part of the official Unity kit. Grab Unity 4.2 shader source and take a look at Sprites/Pixel Snap/Alpha Blended.
The text was updated successfully, but these errors were encountered: