Friday, March 22, 2013

Graphics Assignment 9

I was thinking that this assignment is really easy and it is true indeed. But I could not complete the second part of the assignment properly even after trying hard for a long time.

The first part of the assignment was to  create reflecting surfaces.

I used environment maps for doing so. I used the DirectX's texture tool to create Environment Map. 




I used this environment map to be sure that I am doing all the steps correctly. I could have have created different fancy environment maps but for the assignment I stuck to this one.

I used the camera position to find the vector between the fragment and the camera. Then using the reflect function, I found the reflected vector which was used to look up in the Environment Map to find the exact color for the pixel.

I was done with this part pretty quickly.

The next part was to create different render targets and create some fancy effects. For example, making the translucent objects to have the refraction like feel or magnification. 

The steps were:

1) During Initialization, create a copy of the back buffer.
2) Create a different render target (i.e. the back buffer won't be used for storing the information)
3) Draw all the opaque objects (This information will be written to the user created DirectX surface)
4) After drawing the opaque objects, the back buffer should be set as a render target again.
5) Copy all the information from the user created DirectX surface to the back buffer.

After this step, we have all the information about the opaque objects in an image which will be used by the translucent effects to create fancy effects.

6) Draw the translucent objects.

I thought of another way to do it which would be to:

1) Keep the back buffer as the render target
2) Draw all the opaque objects
3) Copy the back buffer data to a texture which will be used by the translucent objects for creating effects
4) Draw the translucent objects

By doing this, we would not have to change the render targets and the work will be done.

Unfortunately, due to a few problems ( which are unknown right now ), I was not able to exactly do what I intended to. But I will look into it and completely it later.

Here is the Pix screenshot and the Screenshot of the renderer.




No comments:

Post a Comment