New answers tagged

0

I would abandon the though of perfectly averaging all pixels in a block. Instead, sample the color from say 3x3 underlying (but not neighbouring) pixels, while using biliear filtering. This is only 9 texture lookups per final painted pixel - not at all a big job for the GPU. As opposite to per-painted-pixel sampling all pixels in a block and averaging. Say a ...


0

You could render your image to a lower resolution rendertarget with point sampling to achieve a pixelation effect. This way you could use a simple pass-through pixels shader but the sampling of the texture alone would make it pixelated. An other way would be a compute shader. You could dispatch it with the number of desired blocks, and for each block ...


0

To fix the aspect ratio (and speed up the shader a bit): void main() { vec2 diff = (v_position + 1.0) * 0.5 - u_mousePosition; diff.x *= u_aspect; // e.g.: (16.0 / 9.0) for 16:9 float distance = dot(diff, diff); // square of distance, saves a square-root if(distance > u_lightRadius_squared)) { discard; } outColor = ...



Top 50 recent answers are included