1. Take a screenshot of your scene that you'd like to pixelize (
GetImage )
2. Draw sprite with that screenshot as it's image over the scene (depth smaller than that scene, so it's drawn infront if it)
3. Apply this fragment shader to it:
// VERTEX
attribute vec3 position;
attribute vec2 uv;
varying vec2 uvVarying;
uniform vec4 uvBounds0;
uniform mat4 agk_WorldViewProj;
void main()
{
gl_Position = agk_WorldViewProj * vec4(position,1);
uvVarying = uv * uvBounds0.xy + uvBounds0.zw;
}
// FRAGMENT
uniform sampler2D texture0;
varying vec2 uvVarying;
uniform vec4 agk_ObjColor;
uniform float rt_w; //render target width (resolution)
uniform float rt_h; //render target height (resolution)
uniform float pixel_w; // width of a low resolution pixel
uniform float pixel_h; // height of a low resolution pixel
void main()
{
vec3 tc = vec3(1.0, 0.0, 0.0);
float dx = pixel_w*(1./rt_w);
float dy = pixel_h*(1./rt_h);
vec2 coord = vec2(dx*floor(uvVarying.x/dx),dy*floor(uvVarying.y/dy));
gl_FragColor = texture2D(sceneTex, coord).rgb * agk_ObjColor;
}
For rt_w you may give image width, and for rt_h you may give image height. Then for pixel_w and pixel_h you'd give 2.0,2.0 to "divide number of pixels" by two. (I believe it works that way)
Shader example taken from
here
Hope it works for you, I haven't tested it, but it should be fine.
PS. You'll have to find a workaround for no support ( I think there is still no support ) for sprite shaders. Just create a textured plane, then.