Tuesday, 2 April 2013

Soft intersection

This assignment deepen my understanding of render state. If in the last assignment I only know there is a cool thing called render state. In this assignment I know what else I can do with render state and what exactly is render state.

At the beginning I was confused with the opaque render state we had on the previous assignment and the z-buffer render state we supposed to have on this assignment. I confused how should I use them. Should I use them both in the same time or...? After discussed shortly with Derek I understood that I was confused by my own misunderstanding of the render target and the surface. Derek helped understand that I only need one surface for the z-buffer render target. We need two surface for the opaque buffer because we are going to read and write the texture on the same time which is disallowed by DirectX. In z-buffer, we only going to write it on the first pass and then read it in the second pass (when we really draw the opaque and transparent). With this understanding, I have to change my code slightly and make a nicer flow - at least for myself. ^___^

So, this is my object with the soft intersection.

The black ball intersect with the environment-map ball

I multiply the alpha value by 0.6 before saturated it. This make the object gradually intersecting with the plane or the ball.

Depth buffer by PIX and the depth buffer texture

The picture above shows the depth buffer by PIX (left) and the depth buffer texture created with the depth fragment shader. It is really interesting to see how the colour was converted between the one created by PIX and manually created. In PIX, the one that closer to camera look more white while in the one I created look more dark. Well, this is make sense as it is a monochrome texture and the farthest it is, the red the colour should be.

For this assignment I had also re-activated my mesh movement - only for the intersecting object. The control is:
[UP/DOWN]: move in y direction
[LEFT/RIGHT]: move in x direction

1 comment:

  1. This comment has been removed by a blog administrator.

    ReplyDelete