Friday, April 12, 2013

Graphics Assignment 11

This was the best assignment of all time. I have learned a lot of stuff from the assignment. How exactly RenderStates work, why, when and how to change the textures (DirectX textures), how to create some cool effect after you have drawn a scene and other important stuff.

Process that I followed was:

1. Draw everything to the opaque surface.
2. Copy everything from opaque surface to postProcessing surface.
3. Draw translucent bodies on the postProcessing surface

Now the postProcessing surface has everything that is needed to be drawn on screen.

4. Copy everything from postProcessing surface to the BackBuffer.
5. Take in postProcessing texture as in input in the final draw call and create some cool effects.

This is how my final render screen looks like.


I added 2 different kinds of effects. First one was the blurry effect. For doing so, I looked up the color values in the neighboring pixels and averaged it. The current pixel got the averaged value of the neighboring pixels. In the other effect, I added a random color to the pixels. This random color was changed based upon sine, cosine functions.

Final part of the assignment was adding a HUD element. The HUD needs to be drawn on the screen after everything else is drawn. I gave the screen co-ordinates directly to the HUD entity in the Mesh file and it was drawn onto the screen.

Here's the link for the code: Download Code

Graphics Assignment 10

The things that we are making in this graphics class are overwhelming. I had never thought of the cool things that we can do.

In this assignment, I created a depth buffer to make a cool effect. I needed to make a depth buffer of our own because the depth buffer in the graphics hardware cannot be accessed.


I used this depth for creating a blending effect. For doing this, I checked the distance from the camera (i.e. the depth). If the difference between current pixel's depth and previous pixel's was too low then I added transparency to it (value of alpha depended on the difference ).

This is how the effect looks.


Here's the link to my code: Download Code