Friday, March 1, 2013

Graphics Assignment 7

This week I started re-structuring my code as John-Paul said it's hard coded and not completely data-driven. I have created a cScene class in which I have set light and camera, which was previously in cRenderer. Now nothing is hard-coded and when the entities data is changed in the text file, the project works without having to change any code. 

  As I prefer to continue on my own assignment instead of taking my classmate's assignment and working over it, the next part of the back log was sorting the materials and effects, a part of 5th assignment part B.  I used a simple sorting algorithm which sorts the effects first and then sorts the list of entity for same material. 

  For the 7th assignment I have implemented three different types of alpha blending. The first one is partial alpha blending in which I set the  SRC to SRCALPHA and DEST to DESTALPHA. For additive SRC to ONE and DEST to ONE. For, binary alpha, as required, I have turned off the alpha blending.

  I have sorted the opaque entities before loading them in mesh or effect lists. On every draw call I update only the entities with translucent material according to it's distance from the camera for proper alpha blending.

   I have also added  Q,E keys to change the camera position in Z-axis for testing the alpha blending.

 One problem that I couldn't quite solve was the flickering of the two cylinders. I am not sure but it may be because of the cylinder being high poly and as I am sorting it every frame for alpha blending to be proper, it takes the time to render.

  I tried to debug the project in PIX but it's giving me errors in both release and debug build. When I try to debug the release build, the Pix stops working. In debug build it shows the window and the meshes and everything but on exiting it doesn't produce the single frame capture log.

Original Code

Updated code

No comments:

Post a Comment