0 votes

Hi,

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.

Screen:
Screenshot

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.

Code:

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();
 texture.CreateFromImage(frame);

 return texture;

Images used:
enter image description here

Thanks guys !

asked Jun 11 in Engine by Alexande Daubricourt (28 points)

1 Answer

+1 vote
Best answer

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)
answered Jun 11 by SIsilicon (1,173 points)
selected Jun 11 by Alexande Daubricourt

Right !
enter image description here

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.