Sunset Lake Software - Comments for "GPUImagePixellateFilter for round part of an image?" http://www.sunsetlakesoftware.com/forum/gpuimagepixellatefilter-round-part-image Comments for "GPUImagePixellateFilter for round part of an image?" en The elliptical nature of the http://www.sunsetlakesoftware.com/forum/gpuimagepixellatefilter-round-part-image#comment-1460 <p>The elliptical nature of the pixellated region is due to the fact that I use a 0-1.0 coordinate space for the texture coordinates in both X and Y, despite the different pixel dimensions for those two directions. You'll need to account for this, possibly by scaling the Y texture coordinate by the ratio of width / height of the filter frame. You could feed in a uniform to do this.</p> <p>I also use an orthographic projection matrix in my transform filter to do something similar, but I'm not sure if that would be the right approach here.</p> pubDate Wed, 20 Jun 2012 03:40:20 +0000 dc:creator Brad Larson guid false comment 1460 at http://www.sunsetlakesoftware.com Hi again, I tried to modify http://www.sunsetlakesoftware.com/forum/gpuimagepixellatefilter-round-part-image#comment-1458 <p>Hi again,</p> <p>I tried to modify the shader and basically it works fine. The only problem is that the pixelated area is oval but I'd like to have an area where you can see every 'pixel' as a rectangle. </p> <p>Perhaps someone could help me to modify my shader. This is my code so far:</p> <p><div class="geshifilter"><pre class="geshifilter-cocoa"> void main() { highp vec2 textureCoordinateToUse = textureCoordinate; highp float dist = distance(center, textureCoordinate); textureCoordinateToUse -= center; &nbsp; if (dist &lt; radius) { highp vec2 sampleDivisor = vec2(fractionalWidthOfPixel); &nbsp; highp vec2 samplePos = textureCoordinateToUse - mod(textureCoordinateToUse, sampleDivisor); &nbsp; textureCoordinateToUse = samplePos; } &nbsp; textureCoordinateToUse += center; &nbsp; gl_FragColor = texture2D(inputImageTexture, textureCoordinateToUse); } );</pre></div></p> pubDate Tue, 19 Jun 2012 21:21:34 +0000 dc:creator Rahvin guid false comment 1458 at http://www.sunsetlakesoftware.com Thanks for your answer. I'll http://www.sunsetlakesoftware.com/forum/gpuimagepixellatefilter-round-part-image#comment-1456 <p>Thanks for your answer.</p> <p>I'll try to write a modified filter.</p> pubDate Tue, 19 Jun 2012 07:06:09 +0000 dc:creator Rahvin guid false comment 1456 at http://www.sunsetlakesoftware.com Right now, there is no way to http://www.sunsetlakesoftware.com/forum/gpuimagepixellatefilter-round-part-image#comment-1455 <p>Right now, there is no way to do this with the standard filters. However, you could do this by creating a modified variant of the pixellation filter that checks whether the current coordinate is within your circle and if so applies the pixellation effect. If outside the circle, just use the input pixel color without any pixellation.</p> <p>Look at the bump filter for how to determine if a pixel is within a certain radius of a center point. The math in the fragment shader isn't too difficult, and it should be relatively easy to modify the pixellation filter to do this.</p> <p>Otherwise, the mask filter and a blend could do this, but the mask filter was never fixed by the person who submitted it.</p> pubDate Sun, 17 Jun 2012 01:01:18 +0000 dc:creator Brad Larson guid false comment 1455 at http://www.sunsetlakesoftware.com