Friday, February 22, 2013

Graphics Assignment 6

Exporting from Maya was really amazing. I wanted to export some fantastic model. But lack of knowledge in Maya held me back for a lot of time. The Maya Exporter did not work for some meshes. Finally I exported a Spiderman model which looked amazing :D.

After that I moved to converting the file into binary. I was struggling in understanding the concepts for binary file. Sherly and John-Paul helped me to understand it. So I was pretty happy that I will be able to complete the next part quickly. But then a weird error troubled me a lot. When I was writing the file in binary, the compiler gave an Debug Error which said Invalid Allocation Size. Moreover, I could not debug the MeshBuilder application. Debug window did not open and Windows asked whether I want to report the problem. So after trying to find out the problem for a long time, I gave up on that.

Then I added a few more Meshes from Maya and was trying to recompile after deleting the temp folders. A new problem arised. The Mesh builder did not compile. I did not make any change in the Mesh Builder and it started giving me an linker error. I restarted the computer and it started working.



Updated on 1st March:

Since I could not complete the assignment on time, I did not submit the completed assignment. After that I was trying to figure out why my assignment did not work and I could not go ahead. AB, apparently found that the reason for that was my anti-virus program. My anti-virus program blocked some of the .dll files and hence the MeshBuilder did not compile properly. 

After that problem was solved, I pretty much knew what I wanted to do. I created my binary files, read the data from the binary files and then drew the Meshes. Then I moved to the 2nd part of the assignment which was sorting the Meshes in such a way that all the way that all the entities having the same effect are grouped together. Moreover, all the entities having the same material should be grouped together. This was done to minimize the changes between the register data of the GPU (I guess).

After this was done, I was clear for doing the next assignment :D.

Friday, February 15, 2013

Graphics Assignment 5

After I was done with assignment 4, assignment 5 was pretty easy

For making the specular light work, we calculated the dot product between ViewVector and the Normal of the surface. This was multiplied with the dot product of LightDirection and the normal because we did not want light on the opposite side of the Mesh.

Finally exponent was used to define the texture of the mesh.

Download Code


Graphics Assignment 4

Phew......This assignment was too big for me. This assignment needed a good structure.

In my structure, scene has information about the Light, Camera and the Entities.

Entities had information about Meshes and Materials that the mesh will use.

Materials had texture information and effects which will be applied to the Mesh.

So basically a mesh got data from 2 sides. 1. Scene and 2. Materials.

After a mesh had all the information it needed, during the Mesh Update, it drew on the screen. There were more than one entities on the scene, each with a different material and different effect.

I got stuck with a trivial thing for very long time. I could not see anything on the screen. Then Sagar Mistry was tweaking through my PIX and said there could be something wrong with the transforms. So then I checked my files and CameraPosition was {x,y,z} = {0,-10,0} instead of {x,y,z} = {0,0,-10}.

Controls

Moving the camera

W A S D

Moving the Light

T F G H

Moving the objects or meshes

Arrow Keys

Download Code