8
\$\begingroup\$

Have some WWW object downloading a .PNG image.

((SpriteRenderer)renderer).sprite = Sprite.Create(request.texture, 
         new Rect(0,0,100,100));

My sprite looks fine.

Now, let's be a bit redundant and create a Texture2D out of the bytes from the download:

Texture2D t = new Texture2D(100,100);
t.LoadImage(request.bytes);
((SpriteRenderer)renderer).sprite = Sprite.Create(t, new Rect(0,0,t.width,t.height));

Technically, this should produce something identical to the above snippet. However, the sprite is blurry (as in, low quality).

I suppose it is when calling LoadImage. What may be causing this?

\$\endgroup\$
1
  • \$\begingroup\$ I know that textures loaded in the editor can be blurry if MipMapping is on. It should be OFF for 2d textures. Not sure how that relates to loaded from code. \$\endgroup\$
    – ADB
    Sep 22, 2014 at 18:19

1 Answer 1

9
\$\begingroup\$

Try changing the filterMode to Point:

t.filterMode = FilterMode.Point;
\$\endgroup\$
2
  • 1
    \$\begingroup\$ Changing the filter mode worked, although it was Trilinear the one yielding the best results (not sure why). \$\endgroup\$
    – Saturn
    Sep 17, 2014 at 4:45
  • 1
    \$\begingroup\$ I'm glad that sorted it out. I guess I was visualising pixel art (usually best with point filtering) while the ideal mode will vary with art style. \$\endgroup\$ Sep 17, 2014 at 5:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .