Pixel art blurry when using ImageTexture()

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Alexande Daubricourt


I have several pixel art images to superpose in a single image (texture / frame).
But it looks blurry even tough the import is set to pixel art.


At the left: the texture “created” and at the right another texture with the same settings as the images took to create the left one.


var frame = new Image();
 for (var x = 0; x < head.GetWidth(); x++)
  for (var y = 0; y < head.GetHeight(); y++)
   var pixel = head.GetPixel(x, y);
   frame.SetPixel(x, y, frame.GetPixel(x, y).Blend(pixel));
 // Same for other parts..

 var texture = new ImageTexture();

 return texture;

Images used:
enter image description here

Thanks guys !

:bust_in_silhouette: Reply From: SIsilicon

I’ve noticed that your code is in mono, but my reasoning should still apply.
CreateFromImage should have a second argument with a default value of Texture.FLAGS_DEFAULT which means that it will come with mipmaps, repeating, and what you don’t want, filter. So setting it to 0 should do the trick.

texture.CreateFromImage(frame, 0)

Right !
enter image description here

Alexande Daubricourt | 2018-06-11 21:48