Friday, March 8, 2013

Game Graphics Assignment 8

I was very lazy to work on this assignment, but got it finished. It didn't take too long.
I did enjoy doing this assignment as I had never done normal mapping before. I didn't run into any trouble with the actual normal mapping calculations.
I did have to change my material and effect system so that the effect would declare how many textures it wanted, what type each was (diffuse and normal map are my only 2 atm), and what its name is in the shader. Then the material lists how many textures it has and for each what type it is (diffuse or normal map) and the filename.
Then when rendering I have the material and loop through each texture it has and assign it by looking up that same texture type in the effect. I should probably do it the other way around, that the effect looks up the textures it needs in the material. But I only realized that later. the way it is now if the effect expects a normal map and the material doesn't have it, I have no error being thrown. It would just render without the sampler being set (or set tot the correct thing). The other way around I would be able to have the effect warn the user that it expected a texture of type X and the material did not have one.

Ok so i was having trouble with specular light being too bright. This was because i was multiplying the light intensity with the light color and the specular intensity. So the specular was getting the intensity twice. Now only the light color gets the light intensity.

Also had trouble with the letters being not quiet right from some places. The reason was that the y values were backwards. So i redid the height map and now it works correctly. This gave me trouble because the lighting was correct when i went left and right (the sides of the raised letters that were facing the light would light up). But the top and bottom were wrong.



Everything should be working.
Link to Code

No comments:

Post a Comment