Why do my texture’s edges contain unwanted colored lines? Texture looks shifted by a part of a pixel.
Why do my texture’s edges contain unwanted colored lines? Texture looks shifted by a
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Texture2ds can be seen as shifted or misplaced sometimes when you’re not drawing the whole texture, but just a part of it viaSourceRectparameter and the texture’s position (Vector2) has nonintegral coordinates. It may look like undesired texels showing at its edges.If you have a texture with 1px purple border, the actual image can appear with sligthly purple edges. You can avoid that by making the texture coordinates integral.
If this code causes trouble…
…try adding a cast: