In a previous post we saw how to simulate a 3d road, or world in first person using only pixel manipulations. Today i'd like to show another example - a sort of screen saver that simulates depth by playing around with pixels.   We need 2 images - a picture to sample pixels from, and a blank canvas to "paint" to. As show in the video, we're going to simulate a moving image that seemingly flies around in space.   We define a percentage value for each of the four sides of the destination image. For instance, we want the top row to be at a width of 50% of the original image, the bottom row to be 100% (as show here)   0,0,0,1,1,1,1,1, 0, 0,  0,0,0,0,0,0,0,0,0,0,  0,0,0,0,0,0,0,0,0,0,  0,0,0,0,0,0,0,0,0,0,  0,0,0,0,0,0,0,0,0,0,  0,0,0,0,0,0,0,0,0,0,  0,0,0,0,0,0,0,0,0,0,  0,0,0,0,0,0,0,0,0,0,  0,0,0,0,0,0,0,0,0,0,  1,1 , 1 ,1 ,1,1,1,1,1 ,1,   We then calculate the distance between the rows, and the required width of each row along the way using percentages (between 0.5 ...
 
תגובות
הוסף רשומת תגובה