CS525 Project 1 Page
Here is the overall views in page1 and page2:
0. Source code.
suyuzhang-cs525-proj1.zip | |
File Size: | 32 kb |
File Type: | zip |
1. Mirror.
For this shader, first move the texture right a little bit, and then copy the right side of texture to left in a reversed way to get a mirror effect.
2.Mosaic.
To get a mosaic effect, we first need to transfer texture coordinates to our image coordinates, and then use formula
[int(x/32)*32 , int(y/32)*32]
to get the final coordinates in the mosaic image, at last transfer the image coordinates back to texture coordinates to get final output.
[int(x/32)*32 , int(y/32)*32]
to get the final coordinates in the mosaic image, at last transfer the image coordinates back to texture coordinates to get final output.
3.comic or embossing?
I originally plan to do a embossing effect, but then I changed it a little bit make it looks like a comic look..lol..
Firstly, to get a embossing effect, for every pixel we need to calculate the color difference between pixel and the upper left pixel, then add a background color which is gray.
After reach that, I change the background color to white, and enlarge the color difference 10x times to get a edge detection effect.
More interested is when my hand moves fast, there will be some delay effect along the action direction making it more like a comic look.
Firstly, to get a embossing effect, for every pixel we need to calculate the color difference between pixel and the upper left pixel, then add a background color which is gray.
After reach that, I change the background color to white, and enlarge the color difference 10x times to get a edge detection effect.
More interested is when my hand moves fast, there will be some delay effect along the action direction making it more like a comic look.
4.Chromatic aberration.
For this shader we just simply change the coordinates of each color channel, and then zoom it in to get a full screen. vec2 rCoords = 1.09*(texcoord.xy);//causing chromatic dispersion
vec2 gCoords = 1.06*(texcoord.xy);
vec2 bCoords = 1.03*(texcoord.xy);
vec2 gCoords = 1.06*(texcoord.xy);
vec2 bCoords = 1.03*(texcoord.xy);
5.Bump mapping with moving light.
For this one I directly use the demo program we used in the lecture and modified a little bit. Firstly I remap the surface of the bump to texture from camera, and the light move from (1.0, 1.0, 1.0) to (1.0, 1.0, 9.0) repeatly.
6.Fun house mirror - fish eye.
I got the formulas for http://markmail.org/message/56suk3xzy4v7pqai
Firstly use these two formula to polar coordinates:
float r = length(normCoord);
float phi = atan(normCoord.y, normCoord.x);
and calculate final output using:
r = r * r / sqrt(2.0); // fish eye
normCoord.x = r * cos(phi);
normCoord.y = r * sin(phi);
Firstly use these two formula to polar coordinates:
float r = length(normCoord);
float phi = atan(normCoord.y, normCoord.x);
and calculate final output using:
r = r * r / sqrt(2.0); // fish eye
normCoord.x = r * cos(phi);
normCoord.y = r * sin(phi);