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?
8 Bit / Pixel Shaders
Re: 8 Bit / Pixel Shaders
You mean kind of like The Binding Of Isaac Rebirth uses when you enter/exit a level?
Re: 8 Bit / Pixel Shaders
You can use this pixelisation shader:
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.
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);
}
]]
For realy nice pixelisation, it needs to get average pixel from sample. I don't do this.
Science and violence
- Jasoco
- Inner party member
- Posts: 3726
- Joined: Mon Jun 22, 2009 9:35 am
- Location: Pennsylvania, USA
- Contact:
Re: 8 Bit / Pixel Shaders
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.Tjakka5 wrote:You mean kind of like The Binding Of Isaac Rebirth uses when you enter/exit a level?
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.
Who is online
Users browsing this forum: Ahrefs [Bot], Amazon [Bot] and 5 guests