Non-Photorealistic Rendering (NPR) is a special field in Computer Graphics, the goal of these techniques is to create images that resemble pictures made with traditional techniques, like drawings or paintings. My thesis is about painterly rendering: I propose an algorithm that needs only screen space information, and achieves real-time performance. The implementation was made with Unity3D.
The algorithm consists of several steps: first, points are generated with Halton sequences in random positions across the screen. Then, for every generated point, a rectangle is created with a Geometry Shader program, where the original point is the center of the rectangle. These rectangles are rotated according to the luminance gradient of the picture, and they are also scaled. This scaling is based on edge detection (implemented with a Laplace filter), using either the color picture or a texture containing the surface normal vectors and depth information of the picture. When an edge is close to the original point, the rectangle should be small, so it does not cover up any detail. And also if there are no edges nearby, the rectangle should be bigger, because in most cases an artist would use larger brush strokes to fill areas of the same color (eg. in the background). To find the distance, the edge detection is repeated if necessary, using the texels further away from the original in each step.
In the last step, using a Pixel Shader program, every rectangle is textured using a brush texture. The color of each brush stroke is determined by the color of the original image in the center of the rectangle.