Friday, January 25, 2013

Graphics Assignment 2


Download Link: Download Code

I had a tough time with this assignment. The most challenging part was understanding the transformations. Another problem that I faced was with understanding the HLSL part and get it working. I couldn't figure out for a long time on how to get colors in my cube as my cube was  appearing all white on all sides. I then tried to change the o_color = i_color and it worked.
     Getting the camera and the cube moving around was a cakewalk after understanding all the transformations. I found that PIX is really useful in debugging if you know how to use PIX. I am getting better at PIX and in this assignment I learnt a lot about different things that can be done. I spent around 3 days to figure out the transformation and how it works. But now that I am done, everything looks easy.

I was not able to fix the project when run in release build but I will try to remove those ASAP and I will make sure it builds properly in the next assignment.

My cube.txt file looks like this:

8 12
-1.0 -1.0 -1.0 0 255 60
-1.0 1.0 -1.0  0 255 0
1.0 1.0 -1.0 0 0 255
1.0 -1.0 -1.0 25 0 0
-1.0 -1.0 1.0 30 0 255
-1.0 1.0 1.0 0 44 255
1.0 1.0 1.0 255 0 0
1.0 -1.0 1.0 0 255 55

0 1 3
2 3 1
2 7 3
2 6 7
6 5 7
5 4 7
5 1 4
1 0 4
5 2 1
5 6 2
4 0 3
4 3 7

The pre and post vertex PIX shots:



Friday, January 18, 2013

Graphics Assignment 1

Link to code: http://www.sendspace.com/file/xznpk7

I created a .txt file to save coordinates of rectangle. The .txt file looks something like this:


-0.5f,
-0.5f,
-0.5f,
0.0f,
0.0f,
-0.5f,
0.0f,
-0.5f,
-0.5f,
0.0f,
0.0f,
0.0f,

The file parser takes a value for x and y co-ordinate from each line. So, the first value of the file is the x co-ordinate of the first vertex followed by y co-ordinate of the first vertex and so on..

I saw different patterns when I tweaked on the values of the commented part of Pixel and Vertex shaders. 



I found it difficult to display the rectangle by using two triangles. Changing the value of the buffer, that is, changing the size of buffer to 2 from 1, and also changing the value of PrimitveCount to 2, I was able to render the rectangle on the screen.