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 !

in Engine by (30 points)

1 Answer

+4 votes
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)
by (3,891 points)
selected by

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.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.