This was a fun one. This was stuff that I had no clue how to do coming into the assignment. It was also fun because I was able to do all of it with only one change to a file parsing, everything else worked withing the parsing i already had.
I didn't run into (major) problems at any point during this. the environment map worked the first time i compiled. And for the differed rendering part It worked once i got a few small bugs out of the code.
Although I watched the video from the class closely for this assignment.
The effect I made for the special transparent was a magnifying glass. I take the tex coords and pick the back pixel closer to the center of the cube depending on how far outside from the center I am. So the outside of the cube is getting pixel from closer to the center of the cube, while the center of the cube is getting the pixel right behind it.
Everything should be working
Link To Code
picture of pix showing the opaque bucket render target/texture
Tuesday, March 12, 2013
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
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
Tuesday, February 26, 2013
Game Graphics Assignment 7
Not too bad of an assignment. I had done a bit of alpha stuff in both Game Engineering and more in an XNA prototype for game projects 1.
I also didn't have to redesign much of my code. I redid how i was going the draw. Since now i needed to be able to draw objects in different orders, which meant two seperate locations for the draw call, I decided to make a function out of it. So now i have a DrawEntity function that will set all of the effect, material, uniforms that need to be changed and make the draw call.
Then for the Opaque entities i call that function in order of Effect->Material. For the transparent objects i draw them in order of distance away from the camera.
But for the files i only had to update the format for one of the file types, my effect. I added an enum (saved as an int) for whether it was transparent, additive, opaque...
The one part i didn't like is how i had to loop through every entity to check if it had a material that used an effect that was transparent, when drawing the transparent objects. It is a lot of finds that take place (2 * the number of entities you have). I couldn't think of an easy way to divide my entities into opaque and transparent. I can fairly easily do this for the effects, but i have no quick way to get all of the entities that use a specific effect.
So that section is a bit slow, but still fast enough.
Everything should work.
Link To Code
Pix screenshot of events collapsed
Pix screenshot of the Translucent events expanded
I also didn't have to redesign much of my code. I redid how i was going the draw. Since now i needed to be able to draw objects in different orders, which meant two seperate locations for the draw call, I decided to make a function out of it. So now i have a DrawEntity function that will set all of the effect, material, uniforms that need to be changed and make the draw call.
Then for the Opaque entities i call that function in order of Effect->Material. For the transparent objects i draw them in order of distance away from the camera.
But for the files i only had to update the format for one of the file types, my effect. I added an enum (saved as an int) for whether it was transparent, additive, opaque...
The one part i didn't like is how i had to loop through every entity to check if it had a material that used an effect that was transparent, when drawing the transparent objects. It is a lot of finds that take place (2 * the number of entities you have). I couldn't think of an easy way to divide my entities into opaque and transparent. I can fairly easily do this for the effects, but i have no quick way to get all of the entities that use a specific effect.
So that section is a bit slow, but still fast enough.
Everything should work.
Link To Code
Pix screenshot of events collapsed
Pix screenshot of the Translucent events expanded
Friday, February 15, 2013
Productive week
We are really getting a hang of the engine now. This last weekend i spend the whole weekend (it felt like) trying to get the push area to be spawn able I made a post on the Crytek forums asking how to do it. I got three responses within 24 hours, the last one giving me the answer. The answer was i needed to do it in c++ and not lua, although i could expose it to lua if i wanted.
Link to Post
At that point i learned that the real logic of the engine is in C++ and i should do as much in there as i can. If i want to do it in Lua i now find out how to do it in the C++ code then find corresponding function in Lua, or make the function for Lua. This has been working much better. And now that i have been playing around with the C++ so much, and reading their functions, i have a much better understanding of the engine.
I love being able to hit F12 and see the class or function, with some documentation (Video game documentation, crazy germans). also being able to find the references to the functions so i can see them in use.
And the rest of the team is also getting a lot more done with the engine. We have gotten over much of the learning curve and are really starting to make progress.
Link to Post
At that point i learned that the real logic of the engine is in C++ and i should do as much in there as i can. If i want to do it in Lua i now find out how to do it in the C++ code then find corresponding function in Lua, or make the function for Lua. This has been working much better. And now that i have been playing around with the C++ so much, and reading their functions, i have a much better understanding of the engine.
I love being able to hit F12 and see the class or function, with some documentation (Video game documentation, crazy germans). also being able to find the references to the functions so i can see them in use.
And the rest of the team is also getting a lot more done with the engine. We have gotten over much of the learning curve and are really starting to make progress.
Game Graphics Assignment 6
This ended up taking longer than i thought it would. but still didn't take too long.
Once i read that we were making a Maya Exporter i dreaded the assignment. After making an FBX parser for Game Engineering i was not looking forward to dealing with that api again. However all of the maya stuff was already done, and that part of the assignment was super easy.
The binary file part was very easy too, I deal with binary files all the time with my work on the search engine
And as for putting all the vertices and indices in a block, again I had to do that for game engineering 2.
I also changed around the pix events for this assignment (and replaced the zip for the last assignment) because i had them implemented incorrectly.
everything should be working
Link To Code
Picture of pix events, fixed.
Once i read that we were making a Maya Exporter i dreaded the assignment. After making an FBX parser for Game Engineering i was not looking forward to dealing with that api again. However all of the maya stuff was already done, and that part of the assignment was super easy.
The binary file part was very easy too, I deal with binary files all the time with my work on the search engine
And as for putting all the vertices and indices in a block, again I had to do that for game engineering 2.
I also changed around the pix events for this assignment (and replaced the zip for the last assignment) because i had them implemented incorrectly.
everything should be working
Link To Code
Picture of pix events, fixed.
Monday, February 11, 2013
Game Graphics Assignment 5
Overall not too difficult of an assignment. Took some time, but not too bad. I am not sure what was taken out of the assignment, would be interested to know how much more work the original assignment was.
I had implemented specular lighting before (for game engineering 2), so i didn't have much trouble there. Had to play with which direction the normal should face a bit, but got it quickly.
One thing that came up was that i had the wrong arguments to my draw call. It wasn't an issue because i was only daring a single box (so all the offsets were 0), but adding the floor caused problems. After taking a look at my draw call in my engine, it was quick to switch the arguments around and get it drawing the floor.
The biggest part decision wise was how to structure the uniforms. I changed how i was doing it twice while developing it. But I ended up with a nice system that can take any size of a float array and set it only when it needs to be set. How i do this is every time i set a uniform i keep track of its name and value. Then when i try to set the next one i look to see if it is already set. In this case even if i change materials, if they both have the same uniform (name and value) it will not set it again. This all gets cleared when i change the shader.
Everything should be working in the assignment.
Link To Code
Picture from pix debugging
I had implemented specular lighting before (for game engineering 2), so i didn't have much trouble there. Had to play with which direction the normal should face a bit, but got it quickly.
One thing that came up was that i had the wrong arguments to my draw call. It wasn't an issue because i was only daring a single box (so all the offsets were 0), but adding the floor caused problems. After taking a look at my draw call in my engine, it was quick to switch the arguments around and get it drawing the floor.
The biggest part decision wise was how to structure the uniforms. I changed how i was doing it twice while developing it. But I ended up with a nice system that can take any size of a float array and set it only when it needs to be set. How i do this is every time i set a uniform i keep track of its name and value. Then when i try to set the next one i look to see if it is already set. In this case even if i change materials, if they both have the same uniform (name and value) it will not set it again. This all gets cleared when i change the shader.
Everything should be working in the assignment.
Link To Code
Picture from pix debugging
Friday, February 8, 2013
Game Graphics Assignment 4
this assignment took a large amount of time, but was not too difficult. I make may own file format every few weeks it seems, so that was simple. I had already been separating out my code into classes so all i had to do was add in a new class for each part of this assignment.
I was deciding between having a manager class for each of the new types of things. then i could either pass those around or make them all singletons. That way when the material file was loading it could tell the effect manager to load an effect that the material just read. However i decided to instead keep all of the class instances in the scene class and have the scene class be the one that calls load for each object.
So the entity class has its load function called. that function opens up and parses the file. It then returns the names of the mesh and material that it uses. The scene file then will look to see if that mesh has been loaded, if it hasn't then it creates a new Mesh instance and calls the load (giving it the filename).
So each class object has its own information and the name of the other objects it needs. So when i draw i ask for each objects information. The entity returns its world transform and the name of the mesh and material it uses. The scene the looks the mesh up and calls for its information, which returns the vertex buffer offset and index buffer offset.
Everything should be working, as long as i didn't miss something.
To move the camera use w, a, s, d
To move the light use the numpad:
numpad 8: up
numpad 2: down
numpad 4: left
numpad 6: right
numpad 7: in (-Z)
numpad 9: out (+Z)
here is a screenshot of the depth buffer in pix
Subscribe to:
Posts (Atom)