- Home /
Texture image compression issue
I am working on a 2D game and am loading sprites of a sheet I drew up in paint.net. I need to work with exact pixel data, but have noticed that my pixel colors are blending. I believe unity is compressing the pixel data, and some blending occurs.
I have checked this by using the Texture2D class in my script. I have looped through the entire pixel data of my picture, and turned any non-black or non-white pixels green. I drew a black and white image, and sure enough green pixels appeared after loading it up (at the edges of black and white parts). So it is definitely blending. How can I disable this feature?
Answer by jasperstocker · Apr 06, 2012 at 02:03 PM
In the texture properties you need to set the filter mode from "bilinear" to "point". You can do this in the editor by selecting the texture itself and changing the property in the inspector.
Answer by denzilb55 · Apr 06, 2012 at 05:57 PM
Thank you. The actual problem was that the images needed to be power of 2 for some reason.
Getting back to you on this. Power of two $$anonymous$$aths is very quick compared to other numbers so rendering will always work faster when using it. Unity will convert your textures to a power of two by stretching them in order to take advantage of this. The problem being that you can see this stretching at runtime. You can disable this in the texture properties be disabling compression I think. The image in the inspector will show the resolution at the bottom so you can check there if Unity has modified it.
Answer by moonchacha · Nov 11, 2013 at 03:41 PM
If you're using the texture as a GUI element, changing the "Texture Type" in the editor to "GUI" gets rid of compression regardless of the image dimensions.
Your answer
Follow this Question
Related Questions
How to not see white background on texture 1 Answer
Texture Compression format for UWP,Texture 0 Answers
EncodetoPNG and all other file types leaves the image in the wrong color space 0 Answers
is there a way to make textures bigger then 4096 2 Answers
Almost got a PCX parse working, but the colors aren't read properly 1 Answer