Page 1 of 1
8 Bit / Pixel Shaders
Posted: Sun Oct 11, 2015 8:36 pm
by ZacG
Does anybody know of a way to create a shader which pixelates and/or limits colours of the screen?
The colour limiting could be either inputting a number of colours or just making a table consisting of all possible colours. There would also need to be a way to get the closest colour to the pixel's colour I would imagine. Anyway, has anyone made this / knows how I could make it?
Re: 8 Bit / Pixel Shaders
Posted: Sun Oct 11, 2015 8:59 pm
by Tjakka5
You mean kind of like The Binding Of Isaac Rebirth uses when you enter/exit a level?
Re: 8 Bit / Pixel Shaders
Posted: Mon Jan 04, 2016 3:25 am
by HDPLocust
You can use this pixelisation shader:
Code: Select all
shader = love.graphics.newShader [[
extern vec2 size; //vector contains image size, like shader:send('size', {img:getWidth(), img:getHeight()})
extern number factor; //nimber contains sample size, like shader:send('factor', 2), use number is divisible by two
vec4 effect(vec4 color, Image img, vec2 texture_coords, vec2 pixel_coords){
vec2 tc = floor(texture_coords * size / factor) * factor / size;
return Texel(img, tc);
}
]]
Using a big factor, you can get giant pixels.
For realy nice pixelisation, it needs to get average pixel from sample. I don't do this.
Re: 8 Bit / Pixel Shaders
Posted: Mon Jan 04, 2016 5:05 am
by Jasoco
Tjakka5 wrote:You mean kind of like The Binding Of Isaac Rebirth uses when you enter/exit a level?
Or the SNES effect when games would transition from one setting to another like in Mario World when you change from the castle or ghost house intro to the level itself, or Zelda LTTP when you open the map.
But I think the OP means taking the screen image and using a Photoshop-like color dither effect like when you convert an image to a GIF which has a 256 color limit so it has to dither.
I'd say it's easier just to dither the images from the start instead of trying to fake it because it's not going to look right without a lot of work.
Then again, there are times you still need to dither I guess.