How to stop pixel art from becoming blurred?

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
ZacG
Prole
Posts: 5
Joined: Mon Mar 02, 2015 6:21 pm

How to stop pixel art from becoming blurred?

Post by ZacG »

I need a way to stop pixel art being blurred, how would I do this (preferably without resizing the image outside of love2d). I need a way for me to be able to change it's size in game, but keeping a 32x32 image.

I know that in Unity3D, you can just change the image import settings to 'point' instead of 'bilinear'. Is there anything like this in love? I have attached a screenshot of my 32x32 image tripled in size.
Attachments
Spaceship tripled size
Spaceship tripled size
Screen Shot 2015-10-11 at 17.23.52.png (13.45 KiB) Viewed 7214 times
User avatar
veethree
Inner party member
Posts: 875
Joined: Sat Dec 10, 2011 7:18 pm

Re: How to stop pixel art from becoming blurred?

Post by veethree »

image:setFilter("nearest", "nearest"). You can also do love.graphics.setDefaultFilter("nearest", "nearest") before loading the images.
ZacG
Prole
Posts: 5
Joined: Mon Mar 02, 2015 6:21 pm

Re: How to stop pixel art from becoming blurred?

Post by ZacG »

veethree wrote:image:setFilter("nearest", "nearest"). You can also do love.graphics.setDefaultFilter("nearest", "nearest") before loading the images.
Thanks! It seems like it works :)
Sosolol261
Party member
Posts: 125
Joined: Wed Nov 26, 2014 6:43 am

Re: How to stop pixel art from becoming blurred?

Post by Sosolol261 »

Make sure to put it in line 1 since images loaded before that function will still have the "linear" filter.
User avatar
T-Bone
Inner party member
Posts: 1492
Joined: Thu Jun 09, 2011 9:03 am

Re: How to stop pixel art from becoming blurred?

Post by T-Bone »

Sosolol261 wrote:Make sure to put it in line 1 since images loaded before that function will still have the "linear" filter.
I think the optimal place would be near the top of love.load (rather than at the top of the file), for readability and consistency. I'm not sure what happens if you run that before love.load, since I don't think it's guaranteed that graphics are ready.
User avatar
Tesselode
Party member
Posts: 555
Joined: Fri Jul 23, 2010 7:55 pm

Re: How to stop pixel art from becoming blurred?

Post by Tesselode »

I've always just put it at the top of love.load and it works just fine.
Sosolol261
Party member
Posts: 125
Joined: Wed Nov 26, 2014 6:43 am

Re: How to stop pixel art from becoming blurred?

Post by Sosolol261 »

There are people who require files outside of love.load (like me) and if you make an image in any of those files it will use the linear filter.
User avatar
Jasoco
Inner party member
Posts: 3725
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: How to stop pixel art from becoming blurred?

Post by Jasoco »

Either way put it before you load any images. Else you'll have to manually setFilter("nearest") for all of them later.
Post Reply

Who is online

Users browsing this forum: No registered users and 92 guests